System.Web.UI.HtmlControls HtmlControl Class
Sets or retrieves a value indicating whether the Disabled attribute is specified when a server control is rendered.
Inline |
<htmlcontrol disabled ... > |
Script |
HtmlControl.Disabled [ = true | false ] |
This property accepts or returns only a boolean value: true if a control is disabled, and false if not.
This property is read/write with a default value of false.
Disabled is used to specify or determine whether a control is functional. When set ( to true ), 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.
The following example shows how to declaratively set the Disabled property of an HtmlControl at design time.
<input type=text id="myTextBox" disabled runat="server" />
The example below shows how to programmatically enable and disable an HtmlControl 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.Disabled = join.Checked ? false : true;
}
</script>
Show me
HtmlControl Members