If I put my dropdownlist column in ItemTemplate, it appear but I can't change the value. When I put it in EditItemTemplate like this:
<EditItemTemplate>
<asp:DropDownList DataValueField="COLUMN_NAME" DataTextField="COLUMN_NAME" DataSource='<%#GetDataSourceDesCol()%>' Width="90%" Visible=true ID="ddlDesCol" runat="server">
</asp:DropDownList>
</EditItemTemplate>
Then my ddl is not showing any more. How to fix it?
p/s: Even that I try with a new project and simple code like:
<asp:GridView ID="GridView1" AutoGenerateColumns=false runat="server">
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The ddl is not showing too!
All the controls inside the edit item template will be visible only when the grid view is in the edit mode.
So, you need to set the grid to edit mode. Inorder to make your code to work.
Hope this helps..
if you want to put entire grid view in edit mode:
if you want a particular row to be in edit mode
Just implement the Row_Editing event and do something like this:
Bind data will populate the GridView with the data.