System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.WebControls.WebControl System.Web.UI.ICheckBoxControl System.Web.UI.IPostBackDataHandler System.Web.UI.SupportsEventValidation System.Web.UI.ControlValueProperty("Checked", null) System.ComponentModel.DefaultProperty("Text") System.ComponentModel.DefaultEvent("CheckedChanged") System.Web.UI.DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.ComponentModel.Designer("System.Web.UI.Design.WebControls.CheckBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")

In this topic:

Introduction

Declarative Syntax

## Introduction

Use the control to allow the user to select a true or false state.

If you plan to use multiple controls, the control is an alternative control that provides convenient data binding capabilities. However, individual controls provide greater control over layout.

A control accepts user input, which is a potential security threat. By default, ASP.NET mobile Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

## Declarative Syntax

`<asp:CheckBox AccessKey="string" AutoPostBack="True|False" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CausesValidation="True|False" Checked="True|False" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" OnCheckedChanged="CheckedChanged event handler" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" Text="string" TextAlign="Left|Right" ToolTip="string" ValidationGroup="string" Visible="True|False" Width="size" />`

Displays a check box that allows the user to select a true or false condition.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is used primarily by control developers to insert the additional attributes and styles in the output stream for a control. The method overrides the method.

  Adds the HTML attributes and styles of a control to be rendered to the specified output stream.

  An that represents the output stream to render HTML content on the client.
- Property
  System.Boolean To be added: an object of type 'bool'

  Use this property to specify whether the state of the control is posted back to the server when clicked.

  Setting this property to true causes a round trip to the server every time the control is clicked.

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

  Gets or sets a value indicating whether the state automatically posts back to the server when clicked.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue(false)
- Property
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  Use the property to determine whether validation is performed on both the client and the server when a control is selected. Page validation determines whether the input controls that are associated with a validation control on the page all pass the validation rules as specified by the validation control.

  By default, clicking a control does not cause page validation. To perform page validation when the control is clicked, set the property to true.

  When the value of the property is set to true, you can also use the property to specify the name of the validation group for which the control causes validation.

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

  Gets or sets a value indicating whether validation is performed when the control is selected.

- Property
  System.Boolean To be added: an object of type 'bool'

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

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

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

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.Bindable(true, System.ComponentModel.BindingDirection.TwoWay)
  System.ComponentModel.DefaultValue(false)
- Event
  System.EventHandler

  The event is raised when the value of the property changes between posts to the server. This event does not post the page back to the server unless the property is set to true.

  A control must persist some values between posts to the server for this event to work correctly. Be sure that view state is enabled for this control.

  For more information about handling events, see How to: Consume Events in a Web Forms Application.

  Occurs when the value of the property changes between posts to the server.

  1.0.5000.0
  2.0.0.0
- Property
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Web.UI.AttributeCollection To be added.

  The control is rendered and displayed using an HTML INPUT element. You can add additional attributes to the rendered INPUT element using the method on the property.

  Gets a reference to the collection of attributes for the rendered input element of the control.

- Property
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
  System.Web.UI.AttributeCollection To be added.

  The property of a control is rendered and displayed using an HTML LABEL element. You can add additional attributes to the rendered LABEL element using the method on the property.

  Gets a reference to the collection of attributes for the rendered LABEL element of the control.

- Method
  2.0.0.0
  System.Boolean `` ``

  The method is used primarily by control developers.

  The method checks if the postback data of the control is different from its previous value, and if so, loads the content and returns true.

  Processes the postback data for the control.

  true if the posted content is different from the last posting; otherwise, false.

  The index within the posted collection that references the content to load. The collection posted to the server.
- Method
  2.0.0.0
  System.Void ``

  This method is used primarily by the .NET Framework infrastructure and is not intended to be used directly from your code. However, control developers can override this method to specify how a custom server control restores its view state. For more information, see ASP.NET State Management Overview.

  The method restores view-state information for the object from a previous page request that was saved by the method.

  Loads the previously saved view state of the control.

  An object that contains the saved view state values for the control.
- Method
  System.Void ``

  The event is raised when the value of the property changes between posts to the server.

  A control must persist some values between posts to the server for this event to work correctly. Be sure that view state is enabled for this control.

  Raising an event invokes the event handler through a delegate. For more information, see How to: Consume Events in a Web Forms Application

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event of the control. This allows you to handle the event directly.

  A that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` To be added

  Registers client script for generating postback prior to rendering on the client if is true.

  An that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void

  The method is used primarily by control developers.

  The method invokes the method if the posted data for the control has changed. If the property is true, the controls that are set in the property are validated.

  Invokes the method when the posted data for the control has changed.

- Method
  System.Void `` a To be added

  Displays the on the client.

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Object

  The method is used primarily by control developers.

  View state is the accumulation of the values of a server control's properties. These values are automatically placed in the property for the server control, which is an instance of the class. This property's value is then persisted to a string object after the save-state stage of the server control's life cycle. For more information, see ASP.NET Page Life Cycle Overview.

  When view state is saved, this string object is returned to the client as a variable that is stored in a hidden HTML input element. When you author custom server controls, you can improve efficiency by overriding the and modifying the property for your server control. For more information, see Developing Custom ASP.NET Server Controls and ASP.NET State Management Overview.

  Saves the changes to the view state since the time the page was posted back to the server.

  The object that contains the changes to the view state; otherwise, if no view state is associated with the object, null.

- Method
  1.0.5000.0
  2.0.0.0
  System.Boolean `` ``

  determines the posted state.

  Processes posted data for the control.

  true if the state of the has changed; otherwise false.

  The key value used to index an entry in the collection. A that contains post information.
- Method
  1.0.5000.0
  2.0.0.0
  System.Void

  fires an CheckedChanged event.

  Raises when posted data for a control has changed.

- Property
  System.String To be added: an object of type 'string'

  Use this property to specify the text label associated with the control. This property can also be used to programmatically get the text label associated with the control.

  This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see How to: Consume Events in a Web Forms Application.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text label associated with the .

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Localizable(true)
  System.ComponentModel.Bindable(true)
  System.ComponentModel.DefaultValue("")
- Property
  System.Web.UI.WebControls.TextAlign To be added: an object of type 'TextAlign'

  Use this property to specify the alignment of the text label associated with the control. You can specify whether the text label appears to the right or left of the check box. Use the property to specify the label text.

  Gets or sets the alignment of the text label associated with the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.TextAlign.Right)
- Method
  2.0.0.0
  System.Void

  ASP.NET automatically calls the method when the control is initialized.

  Tracks view-state changes to the control so that they can be stored in the control's object. This object is accessible through the property.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.Web.UI.Themeable(false)
  System.String To be added.

  Validation groups allow you to assign validation controls on a page to a specific category. Each validation group can be validated independently of other validation groups on the page. Use the property to specify the name of the validation group for which the control causes validation when it posts back to the server.

  The property has an effect only when the value of the property is set to true. When you specify a value for the property, only the validation controls that are part of the specified group are validated when the control posts back to the server. If you do not specify a value for the and the property is set to true, all validation controls on the page that are not assigned to a validation group are validated when the control posts back to the server.

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

  Gets or sets the group of controls for which the control causes validation when it posts back to the server.