Language

CheckBox.Checked Property

Definition

Gets or sets a value indicating whether the CheckBox control is checked.

public:
 virtual property bool Checked { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
public virtual bool Checked { get; set; }
[System.ComponentModel.Bindable(true, System.ComponentModel.BindingDirection.TwoWay)]
[System.Web.UI.Themeable(false)]
public virtual bool Checked { get; set; }
[]
member this.Checked : bool with get, set
[]
[]
member this.Checked : bool with get, set
Public Overridable Property Checked As Boolean

Property Value

true to indicate a checked state; otherwise, false. The default is false.

Implements

Attributes

Examples

The following example demonstrates how to use the Checked property to determine the state of the CheckBox control.

Note

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Forms Page Code Model.


<%@ Page Language="C#" AutoEventWireup="True" %>




    CheckBox CheckedChanged Example

 

 

 
   

CheckBox CheckedChanged Example

Select whether to include tax in the subtotal.

Shopping cart
Item 1 $1.99
Item 2 $2.99
Item 3 $3.99
Subtotal

<%@ Page Language="VB" AutoEventWireup="True" %>




    CheckBox CheckedChanged Example

 

 

 
   

CheckBox CheckedChanged Example

Select whether to include tax in the subtotal.

Shopping cart
Item 1 $1.99
Item 2 $2.99
Item 3 $3.99
Subtotal

Remarks

Use this property to determine whether the CheckBox control is checked. This property can also be used to programmatically set the state of the CheckBox control.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

Applies to

See also