asp.net - Changing DataSourceId of a dropdown from JavaScript -
can change datasourceid of drop down depending on dropdown selection in javascript got 3 dropdown value on base of selection of dropdown want change datasource of sqldatasource
<script type="text/javascript"> function abc() { if (document.getelementbyid('type').value == "c") { } else if (document.getelementbyid('type').value == "g") { } else if (document.getelementbyid('type').value == "s") { } } </script> <asp:dropdownlist id="type" runat="server" onblur ="abc();"> <asp:listitem>c</asp:listitem> <asp:listitem>g</asp:listitem> <asp:listitem>s</asp:listitem> </asp:dropdownlist> <asp:sqldatasource id="c" runat="server" datasourcemode="datareader" connectionstring="<%$connectionstrings:connstring%>" selectcommand="select rtrim(customer) customer,cust_id a1_customer isactive=1 order customer"> </asp:sqldatasource> <asp:sqldatasource id="g" runat="server" datasourcemode="datareader" connectionstring="<%$connectionstrings:connstring%>" selectcommand="select rtrim(supplier) supplier,sup_id a1_supplier isactive=1 order supplier"> </asp:sqldatasource> <asp:sqldatasource id="s" runat="server" datasourcemode="datareader" connectionstring="<%$connectionstrings:connstring%>" selectcommand="select rtrim(title) title ,acno,ac_type a1_glcard isactive=1 , levels=4 order title"> </asp:sqldatasource> </td> <td> <asp:dropdownlist id="htitle" runat="server" datasourceid="c" datatextfield="customer" datavaluefield="cust_id" width="168px">
Comments
Post a Comment