When I set Enabled to false, it sets the background of the textbox to a grey color, can this be changed? Right now, the grey background with black text makes it a little hard to read.
Or maybe, I have to use the readonly property instead and set the backcolor myself, is this correct?
There are several ways to achieve this:
1) Use CSS to change the look for all the input controls. Just put "input[disabled] { border:solid 1px red; }" in your CSS file.
2) Using ASP.NET skins, in the Skin file you could write:
<asp:TextBox runat="server" SkinID="disabled" CssClass="disabled"></asp:TextBox>
This would set the disabled CSS class only for that TextBox
3) Manually assigning a CSS class to only the TextBoxes you want disabled, like:
<asp:TextBox runat="server" ID="x" Enabled="false" CssClass="disabled"></asp:TextBox>
4) Create your custom control that inherits from TextBox and configure it that way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.