asp.net.ph

CheckBox.Checked Property

System.Web.UI.WebControls Namespace   CheckBox Class


Sets or retrieves a value indicating whether the CheckBox control is checked.

Syntax


Inline <asp:checkbox checked [ = true | false ] ... >
Script CheckBox.Checked [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true to indicate a checked state; otherwise false. Default value is false.

Remarks

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" ] %> />

Example

The following examples demonstrate using the Checked property at design time and at run time.

Dynamic CheckBox Sample
Run Sample | View Source
Dynamically Setting and Retrieving the Font Properties of a Web Control
Run Sample | View Source
Enabling Multiple Item Deletions in a DataGrid
Run Sample | View Source

The following example demonstrates how to dynamically bind the Checked property of CheckBox controls defined within a template.

Using Views Example: Products Inventory
Run Sample | View Source
See Also

CheckBox Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph