Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebControl.IsEnabled Property

Gets a value indicating whether the control is enabled.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

protected internal bool IsEnabled { get; }

Property Value

Type: System.Boolean
true if the WebControl object is enabled; otherwise, false.

This is a read-only property. If you want to disable a control, you set its Enabled property to false.

If a control is not contained by another control, the value of the IsEnabled property is always the same as the value of the Enabled property.

The IsEnabled property has a value that is different from the Enabled property if a control is a child of another control and if all the following circumstances are true:

  • The value of the Enabled property or the IsEnabled property of the parent control is false.

  • The Enabled property of the child control is set to true.

In this situation, the child control inherits the disabled state of the parent control. The IsEnabled property of the child control returns false to indicate that the control is disabled even though the child control was not explicitly disabled by setting its Enabled property to false. The parent control itself might have its Enabled property set to true but might inherit the disabled state from its parent, and so on.

When ASP.NET renders HTML elements for a server control, it marks the elements as disabled by setting their disabled attribute or their CSS class attribute. For more information, see SupportsDisabledAttribute and ControlRenderingCompatibilityVersion.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, 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.

Show:
© 2014 Microsoft