How to make Dropdownlist readonly in C#
.net, asp.net, c#, webforms
Solution
There is no readonly property for `DropDownList` in asp.net
Try using:
<asp:DropDownList ID="DropDownList1" runat="server" Enabled="False">
</asp:DropDownList>
Or change it at runtime:
DropDownList1.Enabled=false;
and change it's css class as well.
DropDownList1.CssClass = "class";
Problem
I am using ``` TextBox.ReadOnly = false; ``` for readonly. How can i fix it on DropDownList? I use Enabled = false properties like... ``` TextBox.Enabled = false; DropDownList.Enabled = false; ``` but, after that css class not call in this both control at run-time. Please give me any properties like "ReadOnly".