Results 1 to 5 of 5

Thread: Putting a dropdownlist in the column header of a GridView

  1. #1
    Join Date
    Feb 2009
    Posts
    5

    Putting a dropdownlist in the column header of a GridView

    Hello,
    I have a Datagrid, In ASP .net environment the user wants to replace the title of the column in the DataGrid with a DropDownlist. I really want to know how to do this?
    Can anyone please help me out with the same.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Putting a dropdownlist in the column header of a GridView


  3. #3
    Join Date
    May 2008
    Posts
    40

    Re: Putting a dropdownlist in the column header of a GridView

    you need to have a template column and in the header template of that column you need to put your DropDown. Something like this -

    Code:
     
    
    1    <asp:TemplateField>
    2    	<HeaderTemplate>
    3    		<asp:DropDownList runat="server" ID="ddlHeaderText">
    4    		</asp:DropDownList>
    5    	</HeaderTemplate>
    6    </asp:TemplateField>

    I hope that will be helpful.

  4. #4
    Join Date
    May 2008
    Posts
    115

    Re: Putting a dropdownlist in the column header of a GridView

    Take a loot at this link:

    http://forums.asp.net/t/1001702.aspx

    It describes how you can dynamically create TemplateFields for the GridView control.

  5. #5
    Join Date
    May 2008
    Posts
    27

    Re: Putting a dropdownlist in the column header of a GridView

    You can write the code in the row databound event of the gridview.

    such as like this

    in that event...

    1. first you specify some unique datakeynames for gridview.
    2. whenever that rowdatabound event fire you can get the datakey for that row.
    3. using that datakeyname ( may be questionid) you fire select query in that event function and bind that result with dropdown in that particular row.
    4. your task completed.

    I hope it will help you..

Similar Threads

  1. Connect USB 3.0 front case panel header to motherboard w/o a header?
    By Dogs-Day-Out in forum Motherboard Processor & RAM
    Replies: 4
    Last Post: 14-04-2012, 07:02 PM
  2. Putting CHAR and INTEGER value in same column
    By Garlands in forum Software Development
    Replies: 3
    Last Post: 11-02-2010, 10:44 PM
  3. Replies: 3
    Last Post: 09-12-2009, 01:11 PM
  4. IIS7: Add expires header or cache-control header
    By quota in forum Software Development
    Replies: 3
    Last Post: 06-06-2009, 07:45 PM
  5. GridView in ASP dotnet need scroll for only a column
    By RadhaV in forum Software Development
    Replies: 3
    Last Post: 04-02-2009, 05:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,989,623.98702 seconds with 17 queries