Triynko Triynko - 1 year ago 112
ASP.NET (C#) Question

Where is the "aspNetDisabled" class defined and why does ASP.NET render an interfering duplicate CSS "class" attribute for it?

When I set the "Disabled" property of an ASP.NET TextBox control to false, the final rendered HTML textarea tag (sent to the browser) includes an 'class="aspNetDisabled"' attribute in addition to the 'disabled="disabled"' attribute. Where is the "aspNetDisabled" class defined?

It seems to me that it's not defined anywhere, and the real killer is that this useless class is interfering with my defined classes, because ASP.NET is rendering this into the control as a duplicate CSS class attribute:

<textarea [...] disabled="disabled" class="aspNetDisabled" class="boxsizingBorder largeinput">

Can anyone else confirm this bug?

Additional Info

IIS Version: 7.0.6000.16386

AppPool .NET Framework Version: v4.0

Server control tag in ASPX page:

<asp:TextBox ID="txtInput1" class="boxsizingBorder largeinput" runat="server" TextMode="MultiLine"></asp:TextBox>.

Answer Source

You might want to look at this:

For one, there is no "class" attribute. This is a HTML control; if you want server-side access, you need to add the runat="server" attribute. There is a "Disabled" property. There is also a "Style" property.

Can you explain exactly what it is you are trying to do and why you're not using a TextBox instead with the TextMode property set to multiline?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download