Search code examples
c#asp.nettwitter-bootstraptextbox

Disabled aspx button lose bootstrap class


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.


Solution

  • You can do this:

    // Code
    tbid.Attributes["disabled"] = "disabled";