I currently have a gridview that has a DataTable as its DataSource. A few of the colums in the DataTable are the information that I need and the rest I want to discard. For example, let's say that there are 10 columns in the DataTable, 3 of which contain
useful information and 7 of which contain unneeded information.
I currently have three dropdownlists (one for each useful data item), which are seperate from the GridView, but populated with the titles of all the columns in the DataTable/GridView. The user selects the column where each of the useful pieces of information
is included using the three dropdownlists and then clicks a button to extract the useful data and discard the rest.
For a variety of reasons, I need to switch over to a new layout, where there is a row of dropdownlists at the top of the gridview (i.e. one dropdownlist per column), and the user selects "useful data A", "useful data B", "useful data C" or "not useful" from
the dropdownlist above each column in the Gridview.
I know that you can add a column of dropdownlists to a gridview using the ItemTemplate, but I'm not sure how to add a row of dropdownlists. Could somebody point me in the right direction?
bwol
Member
4 Points
34 Posts
How to Add a Row of Dropdownlists to the top of a GridView
Aug 25, 2009 04:20 PM|LINK
Hi,
I currently have a gridview that has a DataTable as its DataSource. A few of the colums in the DataTable are the information that I need and the rest I want to discard. For example, let's say that there are 10 columns in the DataTable, 3 of which contain useful information and 7 of which contain unneeded information.
I currently have three dropdownlists (one for each useful data item), which are seperate from the GridView, but populated with the titles of all the columns in the DataTable/GridView. The user selects the column where each of the useful pieces of information is included using the three dropdownlists and then clicks a button to extract the useful data and discard the rest.
For a variety of reasons, I need to switch over to a new layout, where there is a row of dropdownlists at the top of the gridview (i.e. one dropdownlist per column), and the user selects "useful data A", "useful data B", "useful data C" or "not useful" from the dropdownlist above each column in the Gridview.
I know that you can add a column of dropdownlists to a gridview using the ItemTemplate, but I'm not sure how to add a row of dropdownlists. Could somebody point me in the right direction?
Thanks!
PeteNet
All-Star
81342 Points
11398 Posts
Re: How to Add a Row of Dropdownlists to the top of a GridView
Aug 25, 2009 04:29 PM|LINK
would this help: http://www.aspsnippets.com/post/Adding-Dynamic-Rows-in-GridView-with-DropDownLists-in-ASPNet.aspx
Peter