asp.net.ph

WebControl.Enabled Property

System.Web.UI.WebControls Namespace   WebControl Class


Sets or retrieves a value indicating whether a Web control is enabled.

Syntax


Inline <asp:control enabled [ = true | false ] ... >
Script WebControl.Enabled [ = true | false ]

Property Value

This property accepts or returns only a boolean value, meaning true if a control is enabled, and false if not.

This property is read/write with a default value of true.

Remarks

Enabled is used to specify or determine whether a control is functional. When set to false, the property has the following effects on a control:

  • Disabled controls do not receive focus.
  • Disabled controls are skipped in tabbing navigation.
  • The data contained in a disabled control cannot be submitted with the form data set.

How disabled elements are rendered depends on the browser. In Microsoft® Internet Explorer® 4 and later, disabled controls appear dimmed and does not respond to user input.

NOTE: This property propagates down the control hierarchy. Hence, disabling a container control disables all child controls within that container.

Example

The following example shows how to declaratively set the Enabled property of a Web control at design time.

<asp:textbox id = "myTextBox" enabled = "false" runat = "server" />

The example below shows how to programmatically enable and disable a Web control at run time, depending on the status of another control that is set by the user.

<script language = "C#" runat = "server">
void Page_Load ( Object src, EventArgs e ) {
   myEmail.Enabled = join.Checked ? true : false;
}
</script>

 Show me 

See Also

WebControl Members   Base Web Control Properties Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph