ASP.NET CheckBox Control
Definition and Usage
The CheckBox control is used to display a checkbox.
Property
Property | Description | .NET |
---|---|---|
AutoPostBack | Specifies whether the form is immediately posted back to the server after the Checked property has changed. The default is false. | 1.0 |
CausesValidation | Specifies whether validation is executed when the Button control is clicked. | 2.0 |
Checked | Specifies whether the checkbox is checked. | 1.0 |
InputAttributes | The set of attribute names and values used by the Input element of the CheckBox control. | 2.0 |
LabelAttributes | The set of attribute names and values used by the Label element of the CheckBox control. | 2.0 |
runat | Specifies that the control is a server control. It must be set to "server". | 1.0 |
Text | Text label associated with the CheckBox | 1.0 |
TextAlign | Alignment of the text label associated with the CheckBox control (right or left) | 1.0 |
ValidationGroup | The control group to be validated when the CheckBox control is posted back to the server. | 2.0 |
OnCheckedChanged | The name of the function executed when the Checked property is changed. |
Web Control Standard Properties
AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled SkinID, Style, TabIndex, ToolTip, Width
For a complete description, please visit Web Control Standard Properties.
Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visitControl Standard Properties.
Example
- Checkbox
- In this example, we declared two TextBox controls and one CheckBox control in the .aspx file. Then, we created an event handler for the CheckedChanged event, copying the content of the text box containing the home phone to the text box containing the work phone.