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.
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.
Assigning a DropDownList Value in a ASP.NET GridView Using ObjectDataSource
And
http://www.codeproject.com/KB/webfor...oBoxField.aspx
I think this page will help you more regarding your problem!
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.
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.
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..
Bookmarks