asp.net - Details view finding a dropdown list box -
how can find command in detailsview....
i believe needs done in databound event , post current value of datasource field ddl.selectedvalue?
dim ddl dropdownlist = directcast(detailsview1.insertitem, dropdownlist).(findcontrol("dropdownlist1"), dropdownlist)
i adding ddl nowadays current value of field , selectable in edit mode.
mark added:
<asp:templatefield headertext="active" sortexpression="active"> <itemtemplate> <asp:label id="label2" runat="server" text='<%# bind("active") %>'> </asp:label> <asp:dropdownlist id="dropdownlist2" runat="server" datatextfield='<%# bind("active") %>' > </asp:dropdownlist> </itemtemplate> <edititemtemplate> <asp:textbox id="textbox2" runat="server" text='<%# bind("active") %>'></asp:textbox> <asp:dropdownlist id="dropdownlist2" runat="server" > </asp:dropdownlist> </edititemtemplate> <insertitemtemplate> <asp:textbox id="textbox2" runat="server" text='<%# bind("active") %>'></asp:textbox> </insertitemtemplate> </asp:templatefield>
solved it, inline code.
<itemtemplate> <asp:label id="label2" runat="server" text='<%# bind("active") %>'></asp:label> </itemtemplate> <edititemtemplate> <asp:dropdownlist id="dropdownlist2" runat="server" selectedvalue='<%# bind("active") %>' > <asp:listitem>y</asp:listitem> <asp:listitem>n</asp:listitem> </asp:dropdownlist> </edititemtemplate>
asp.net vb.net detailsview
No comments:
Post a Comment