Tuesday, January 8, 2013

Disable/enable Dropdownlist in asp.net using c#.net

In this post i will show how to disable a drop down in asp.net using c#.net.Here i have used two drop down lists to perform this task. Whenever  the first drop down  selected then another drop down will be disabled
<asp:DropDownList ID="ddloption" runat="server" onselectedindexchanged="ddloption_SelectedIndexChanged" 
<asp:ListItem>Please select</asp:ListItem>
<asp:DropDownList ID="ddlcode" runat="server" 
<asp:ListItem>Please select</asp:ListItem>
Code :
protected void ddloption_SelectedIndexChanged(object sender, EventArgs e)
ddlcode.Enabled = false;
The above code is for drop down selected index event for first drop down list

No comments: