I have a textbox and dropdown with items All, abc, etc
. i wanted javascript code that disables the textbox when all is selected and enable it when anything else is selected.
I worked it out with that code but the issue is that if form is posted the textbox is disabled even when abc or anything else is selected.
<script type="text/javascript">
function changeddl() {
document.getElementById("txtsearch").disabled = document.getElementById("ddlcolumn").value == "All";
}
</script>
aspx
<asp:DropDownList ID="ddlcolumn" runat="server" CssClass="ddl" Width="120px" AppendDataBoundItems="true" ClientIDMode="Static" ValidationGroup="Search" onchange="changeddl();" >
<asp:ListItem>All</asp:ListItem>
<asp:ListItem>abc</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtsearch" runat="server" CssClass="txt" Width="200px"
ValidationGroup="Search" ClientIDMode="Static" SkinID="txt"></asp:TextBox>