Gets or sets the CSS class to apply to the rendered HTML element when the control is disabled.
Assembly: System.Web (in System.Web.dll)
This property can be used to change the name that is rendered for the property of individual Web controls. By default, this property returns "aspNetDisabled".
When SupportsDisabledAttribute is overridden in a derived class to return false, the value of the property is rendered as the value of the class attribute of the HTML element for the control. In that case, if there is a value in the CssClass property, both CSS classes will be applied to the rendered HTML element. The class attribute will consist of the value of the property followed by the value of the CssClass property, separated by a space.
This property is static, which means that you can set it only for the WebControl class. Whatever value you set it to is used for all controls in a Web application. You cannot specify different values for individual controls.
If you want to use a class name different from the default value of "aspNetDisabled", you typically put the code to do that in the Application_Start method of the Global.asax file, as shown in the following example:
The following example shows rendered HTML for a disabled Label control when the SupportsDisabledAttribute property is false, when the property has its default value, and when the CssClass property is empty.
<span id="Label1" class="aspNetDisabled">Test</span>
The following example shows rendered HTML under the same conditions except that the CssClass property has the value "SampleStyle":
<span id="Label1" class="aspNetDisabled SampleStyle">Test</span>
For more information, see the SupportsDisabledAttribute property.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.