Displaying a DropDownList column in GridView and setting the selected item.
[sourcecode language="csharp"]
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Status") %>' autocomplete="off" Width="150">
<asp:ListItem Value="1">Enable</asp:ListItem>
<asp:ListItem Value="2">Disable</asp:ListItem>
<asp:ListItem Value="3">Delete</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
[/sourcecode]
No comments:
Post a Comment