I have this textbox
<asp:TextBox ID="tbid" runat="server" class="form-control"></asp:TextBox>
form-control is a bootstrap class so the textbox gets the bootstrap look, if I disable the control from code using
tbid.Enabled = false;
the textbox loses the form-control class, after inspected the textbox I found out that it gets replaced by the aspNetDisabled class.
how I can prevent the change of class I want to keep the disabled button with the bootstrap look even if it is disabled.
You can do this:
// Code
tbid.Attributes["disabled"] = "disabled";
I was having similar issues, but strangely only on some buttons on my page, so this piqued my curiosity...
Try using the CssClass instead of Class attribute, and it will work as expected.
<asp:Button id="Button1" runat="server" CssClass="btn btn-warning" Text="My Button" OnClick="Button1_Click" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With