c# - is it possible to bind hiddenfield to dropdownlist? -
<asp:dropdownlist id="ddlpackage" runat="server" cssclass="ddlpackage" height="24px" width="250px"> </asp:dropdownlist> <cc1:listsearchextender id="ddlpackage_listsearchextender" runat="server" enabled="true" targetcontrolid="ddlpackage"> </cc1:listsearchextender> <asp:label id="lblpackage" runat="server" cssclass="errormsg" style="color: red; display: none;"></asp:label> <asp:hiddenfield id="hdnnewoldtype" runat="server" value='<%#bind("newoldtype") %>' />
is possible bind hiddenfield dropdownlist?
if have 3 columns in datatable :
- code
- name
- type
and if want check type based on selected code can use selectedindexchanged event of drop down list mention below :
code dropdown list :
<asp:dropdownlist id="ddlpackage" runat="server" cssclass="ddlpackage" height="24px" width="250px" onselectedindexchanged="ddlpackage_onselectedindexchanged"> </asp:dropdownlist>
code behind :
protected void ddlpackage_onselectedindexchanged(object sender, eventargs e) { var selectedcode = this.ddlpackage.selectedvalue; // code check type selectedcode }
Comments
Post a Comment