System.Web.UI.WebControls Namespace CheckBox Class
Sets or retrieves a value indicating whether the CheckBox control is checked.
Inline |
<asp:checkbox checked [ = true | false ] ... > |
Script |
CheckBox.Checked [ = true | false ] |
This property accepts or returns only a boolean value: true to indicate a checked state; otherwise false. Default value is false.
Use the Checked property to declaratively set the initial state of a CheckBox control. This property can also be used to programmatically specify or determine whether the CheckBox control is checked.
In certain cases, as when checkboxes or radiobuttons ( which inherit this property ) are used within templated controls, the Checked property is usually obtained dynamically from a data source.
<asp:checkbox runat = "server"
checked=<%# ( ( IDataRecord ) Container.DataItem ) [ "Stopped" ] %> />
The following examples demonstrate using the Checked property at design time and at run time.
The following example demonstrates how to dynamically bind the Checked property of CheckBox controls defined within a template.
CheckBox Members