TCheckBox creates a check box on the page. You can specify the caption to display beside the check box by setting the Text property. The caption can appear either on the right or left of the check box, which is determined by the TextAlign property.
To determine whether the TCheckBox component is checked, test the Checked property. The OnCheckedChanged event is raised when the Checked state of the TCheckBox component changes between posts to the server. You can provide an event handler for the OnCheckedChanged event to to programmatically control the actions performed when the state of the TCheckBox component changes between posts to the server.
Note, Text will be HTML encoded before it is displayed in the TCheckBox component. If you don't want it to be so, set EncodeText to false.
Namespace: System.Web.UI.WebControls
Properties
Text, string, kept in viewstate
Gets or sets the text caption displayed in the TCheckBox component.
EncodeText, boolean, default=true, kept in viewstate
Gets or sets the value indicating whether Text should be HTML-encoded when rendering.
TextAlign, Left|Right, default=Right, kept in viewstate
Gets or sets the alignment of the text label associated with the TCheckBox component.
Checked, boolean, default=false, kept in viewstate
Gets or sets a value indicating whether the TCheckBox component is checked.
AutoPostBack, boolean, default=false, kept in viewstate
Gets or sets a value indicating whether the TCheckBox automatically posts back to the server when clicked.
Events
OnCheckedChanged Occurs when the value of the Checked property changes between posts to the server.
Examples
On a page template file, insert the following line to create a TCheckBox component,
The checkbox will show "Agree" text on its right side. If the user makes any change to the Checked state, the checkAgree() method of the page class will be invoked automatically.
This method is invoked when the value of the Checked property changes between posts to the server.
The method raises 'OnCheckedChanged' event to fire up the event delegates. If you override this method, be sure to call the parent implementation so that the event delegates can be invoked.