Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP.NET CheckBox Control

ASP.NET CheckBox Control


Web Server Controls Web Server Controls


Definition and Usage

The CheckBox control is used to display a check box.


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 performed when the Button control is clicked. 2.0
Checked Specifies whether the check box is checked. 1.0
InputAttributes A collection of attribute names and values used by the Input element of this CheckBox control. 2.0
LabelAttributes A collection of attribute names and values used by the Label element of this CheckBox control. 2.0
runat Specifies that this control is a server control. Must be set to "server". 1.0
Text The text label associated with the check box. 1.0
TextAlign The alignment of the text label associated with the check box. (right or left) 1.0
ValidationGroup The control group to be validated when the CheckBox control posts 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。

Web Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a complete description, please visit Web Control Standard Properties。


Example

Checkbox
In this example, we declare two TextBox controls and one CheckBox control in the .aspx file. Then we create an event handler for the CheckedChanged event that copies the content of the text box containing the home phone into the text box containing the work phone.


Web Server Controls Web Server Controls