Dropdownlist while editing a gridview
-
in my application when i edit a row in a gridview for a particular column i have to display a dropdownlist thats ok but when the dropdownlist is loaded i have to display the selected value as the value that is retrieved from the database how is it possible? this is the code for gridview for that particular column <asp:TemplateField HeaderText="Mandal Type" ItemStyle-Width="30%"> <ItemTemplate> <%# Eval("nMandalType") %> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlMandalType" runat="server"> <asp:ListItem Value="0">--SELECT--</asp:ListItem> <asp:ListItem Value="101" >Mandal</asp:ListItem> <asp:ListItem Value="102">Municipality</asp:ListItem> <asp:ListItem Value="103">Division</asp:ListItem> </asp:DropDownList> </EditItemTemplate> <FooterTemplate> <asp:DropDownList ID="ddlNewMandalType" runat="server"> <asp:ListItem Value="0">--SELECT--</asp:ListItem> <asp:ListItem Value="101" >Mandal</asp:ListItem> <asp:ListItem Value="102">Municipality</asp:ListItem> <asp:ListItem Value="103">Division</asp:ListItem> </asp:DropDownList> </FooterTemplate> <ItemStyle Width="30%" /> </asp:TemplateField>
-
in my application when i edit a row in a gridview for a particular column i have to display a dropdownlist thats ok but when the dropdownlist is loaded i have to display the selected value as the value that is retrieved from the database how is it possible? this is the code for gridview for that particular column <asp:TemplateField HeaderText="Mandal Type" ItemStyle-Width="30%"> <ItemTemplate> <%# Eval("nMandalType") %> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddlMandalType" runat="server"> <asp:ListItem Value="0">--SELECT--</asp:ListItem> <asp:ListItem Value="101" >Mandal</asp:ListItem> <asp:ListItem Value="102">Municipality</asp:ListItem> <asp:ListItem Value="103">Division</asp:ListItem> </asp:DropDownList> </EditItemTemplate> <FooterTemplate> <asp:DropDownList ID="ddlNewMandalType" runat="server"> <asp:ListItem Value="0">--SELECT--</asp:ListItem> <asp:ListItem Value="101" >Mandal</asp:ListItem> <asp:ListItem Value="102">Municipality</asp:ListItem> <asp:ListItem Value="103">Division</asp:ListItem> </asp:DropDownList> </FooterTemplate> <ItemStyle Width="30%" /> </asp:TemplateField>
4anusha4 wrote:
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
4anusha4 wrote:
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]