c# - How to bind static dropdownlist on gridview edit -
i want place static dorpdownlist edititemtemplate of gridview.
<edititemtemplate> <%--<asp:textbox id="txtsuppstatus" width="40px" runat="server" text='<%#eval("suppstatus") %>' />--%> <asp:dropdownlist id="ddlsuppstatus" autopostback="true" runat="server" selectedvalue='<%#eval("suppstatus") %>'> <asp:listitem text="yes" value="y"></asp:listitem> <asp:listitem text="no" value="n"></asp:listitem> </asp:dropdownlist> </edititemtemplate>
when page load yes or no option show text when user edit row on click on edit show dorpdownlist yes , no option.
dropdownlist binding on edit loosing data @ time of edit.
i have gone through link facing same problem. rest control getting blank , dropdownlist binding yes , no option.
on page load
after edit
please me how solve this.
you need itemtemplate
field initial display, , seperate edititemtemplate
dropdown list:
<asp:templatefield> <itemtemplate> <asp:label id="label1" runat="server" text='<%#eval("suppstatus") %>'></asp:label> </itemtemplate> <edititemtemplate> <asp:dropdownlist runat="server" selectedvalue='<%#eval("suppstatus") %>'> <asp:listitem text="yes" value="y"></asp:listitem> <asp:listitem text="no" value="n"></asp:listitem> </asp:dropdownlist> </edititemtemplate> </asp:templatefield>
Comments
Post a Comment