System.Web.UI.WebControls.WebControl.Enabled Property

Gets or sets a value indicating whether the Web server control is enabled.

Syntax

[System.Web.UI.Themeable(false)]
[System.ComponentModel.DefaultValue(true)]
[System.ComponentModel.Bindable(true)]
public virtual bool Enabled { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When the WebControl.Enabled property of a control is set to false, the control typically appears dimmed. If the control is an input element, the browser prevents the user from clicking or typing in it. HTML elements that are rendered for a server control are marked as disabled by setting their disabled attribute or their CSS class attribute. For more information, see WebControl.SupportsDisabledAttribute and System.Web.Configuration.PagesSection.ControlRenderingCompatibilityVersion.

This property propagates down the control hierarchy. If you disable a container control, the child controls within that container are also disabled. For more information, see the WebControl.IsEnabled property.

Note:

In a custom composite control, this inheritance behavior does not apply to controls that have not yet created their child controls. You must either set the enabled state of the child controls when they are created, or override the WebControl.Enabled property to call the System.Web.UI.Control.EnsureChildControls method.

Note:

Disabling a control only prevents interaction with the control by the user through the browser UI. It is possible for a user to craft a request that submits a postback that is processed by the page even if controls on the page are disabled. Before you process a postback request, check to make sure that the control is enabled and visible.

Not all controls support this property. See the individual controls for details.

This property cannot be set by themes or style sheet themes. For more information, see System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0