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.ListControl
System.Web.UI.INamingContainer
System.Web.UI.IPostBackDataHandler
System.Web.UI.WebControls.IRepeatInfoUser
In this topic:
-
Introduction
-
Specifying List Layout
-
Specifying List Items
-
Accessibility
-
Declarative Syntax
Introduction
The control provides a multi selection check box group that can be dynamically generated with data binding. It contains an collection with members corresponding to individual items in the list. To determine which items are checked, iterate through the collection and test the property of each item in the list.
You can also use multiple controls. The control is easier for creating a set of check boxes using data binding, while the individual control gives you greater control over layout.
Specifying List Layout
You can specify the way the list is displayed by using the and properties. For information about layout options, see the enumeration.
By default, is set to RepeatDirection.Vertical. Setting this property to RepeatDirection.Horizontal renders the list horizontally. Some settings do not allow horizontal layout. For more information, see the enumeration.
Specifying List Items
To specify items that you want to appear in the control, place a ListItem element for each entry between the opening and closing tags of the control.
The control also supports data binding. To bind the control to a data source, first create a data source, such as one of the objects, that contains the items to display in the control. Next, use the method to bind the data source to the control. Use the and properties to specify which field in the data source to bind to the Text and Value properties of each list item in the control, respectively. The control will now display the information from the data source.
To determine the selected items in the control, iterate through the collection and test the property of each item in the collection.
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. You can use validation controls to verify user input before displaying the input text in a control. ASP.NET provides an input request validation feature to block script and HTML in user input. For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Introduction to Validating User Input in ASP.NET Web Pages.
Accessibility
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.
Declarative Syntax
<asp:CheckBoxList
AccessKey="string"
AppendDataBoundItems="True|False"
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"
CellPadding="integer"
CellSpacing="integer"
CssClass="string"
DataMember="string"
DataSource="string"
DataSourceID="string"
DataTextField="string"
DataTextFormatString="string"
DataValueField="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"
OnDataBinding="DataBinding event handler"
OnDataBound="DataBound event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnSelectedIndexChanged="SelectedIndexChanged event handler"
OnTextChanged="TextChanged event handler"
OnUnload="Unload event handler"
RepeatColumns="integer"
RepeatDirection="Horizontal|Vertical"
RepeatLayout="Table|Flow|OrderedList|UnorderedList"
runat="server"
SelectedIndex="integer"
SelectedValue="string"
SkinID="string"
Style="string"
TabIndex="integer"
TextAlign="Left|Right"
ToolTip="string"
ValidationGroup="string"
Visible="True|False"
Width="size"
>
<asp:ListItem
Enabled="True|False"
Selected="True|False"
Text="string"
Value="string"
/>
</asp:CheckBoxList>
Creates a multi selection check box group that can be dynamically created by binding the control to a data source.
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
Property
System.Int32
To be added: an object of type 'int'
Use this property to control the spacing between the contents of a cell and the cell's border in the control.
The padding amount specified is added to all four sides of a cell with the height of the tallest cell and width of the widest cell in the control. The resulting cell size is applied uniformly to all cells in the control.
Gets or sets the distance (in pixels) between the border and contents of the cell.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(-1)
Property
System.Int32
To be added: an object of type 'int'
Use this property to control the spacing between individual cells in the control. This property is applied both vertically and horizontally.
Gets or sets the distance (in pixels) between cells.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(-1)
Method
System.Web.UI.WebControls.Style
The method is used primarily by control developers in custom controls that derive from the class.
Creates a style object that is used internally by the control to implement all style related properties.
A that contains the style properties of the control.
1.0.5000.0
2.0.0.0
Method
System.Web.UI.Control
The method is used primarily by control developers in custom controls that derive from the class.
The method overrides the method of the base class. You should not override this version of the method.
Searches the current naming container for a server control with the specified ID and path offset. The method always returns the object.
The current .
The identifier for the control to find.
The number of controls up the page control hierarchy needed to reach a naming container.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Web.UI.WebControls.Style
The method is used primarily by control developers in custom controls that derive from the class.
The style attribute for the control applies to all list items that are contained by the control. Use the property of the to examine or set the style attribute for the control and its list items.
Retrieves the style of the specified item type at the specified index in the list control.
null, indicating that style attributes are not set on individual list items in a control.
One of the enumeration values.
An ordinal index that specifies the location of the item in the list control.
Property
2.0.0.0
System.Boolean
To be added.
The property is used primarily by control developers in custom controls that derive from the class. Footers are not supported when the property is set to or .
Gets a value indicating whether the control contains a footer section.
Property
2.0.0.0
System.Boolean
To be added.
The property is used primarily by control developers in custom controls that derive from the class. Headers are not supported when the property is set to or .
Gets a value indicating whether the control contains a heading section.
Property
2.0.0.0
System.Boolean
To be added.
The method is used primarily by control developers in custom controls that derive from the class. Separators are not supported when the property is set to or .
Gets a value indicating whether the control contains a separator between items in the list.
Method
2.0.0.0
System.Boolean
The method is used primarily by control developers in custom controls that derive from the class.
The method indicates whether the state of the control has changed. In other words, it determines whether each list item in the control has the same value as the last posted value. A user selecting or clearing an item in the control changes the property value for the corresponding object in the collection of the control. If the same list items are selected in the control, or if the is disabled, returns false.
When the method returns true for a control, the page framework invokes the method for the control.
Processes the posted data for the control.
true if the state of the is different from the last posting; otherwise, false.
The key identifier for the control, used to index the specified in the parameter.
A that contains value information indexed by control identifiers.
Method
System.Void
The method is used primarily by control developers in custom controls that derive from the class. The method allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
The method performs any necessary prerendering steps prior to saving view state and rendering content for the . The individual list items contained in the control are initialized for rendering using the current , , and values.
Configures the control prior to rendering on the client.
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 in custom controls that derive from the class.
The page framework calls the method on a control when the method indicates that the state of the list items have changed in the control. The method calls the method to raise the event. Control developers can override the method to perform custom processing when the user selects or clears list items in the control.
The method can optionally perform validation before raising the event for the control. To validate a group of controls on the page when a list item within the is selected, set the and properties to true, and specify the group of controls to validate in the property.
Notifies the ASP.NET application that the state of the control has changed.
Method
System.Void
The method is used primarily by control developers in custom controls that derive from the class.
The implementation for a control initializes a object for the list, and calls the method, which in turn uses the method to render individual check box list items.
Displays the on the client.
A that contains the output stream for rendering on the client.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Void
This method is used primarily by control developers in custom controls that derive from the class.
The implementation for a control calls the method, which in turn uses the method to render individual checkbox list items.
The method for a control ignores the and parameters. The value is used to select the checkbox list item in the collection, and the selected list item is rendered to the output stream.
Renders a list item in the control.
One of the enumeration values.
An ordinal index that specifies the location of the item in the list control.
A object that represents the information used to render the item in the list.
An object that represents the output stream to render HTML content on the client.
Property
System.Int32
To be added: an object of type 'int'
When the property is set to , you can use this property to specify the number of columns that display in the control. If this property is not set, the control displays all list items in a single column.
Gets or sets the number of columns to display in the control.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(0)
Property
System.Web.UI.WebControls.RepeatDirection
To be added: an object of type 'RepeatDirection'
Use this property to specify the display direction of the control.
The number of columns that are displayed is always determined by the property.
If this property is set to RepeatDirection.Vertical and if the property is set to , the first column is filled from top to bottom, then the next column, and so on until all items are rendered. For example, if the property is set to 3, the items in the control are displayed in three columns, as in the following table.
-
1
4
7
-
2
5
8
-
3
6
9
If this property is set to RepeatDirection.Horizontal and if the property is set to , the first column is filled from top to bottom, then the next column, and so on until all items are rendered. For example, if the property is set to 3, the items of the control are displayed in rows of three items each, as in the following table.
-
1
2
3
-
4
5
6
-
7
8
9
Gets or sets a value that indicates whether the control displays vertically or horizontally.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(System.Web.UI.WebControls.RepeatDirection.Vertical)
Property
2.0.0.0
System.Int32
To be added.
The property is used primarily by control developers in custom controls that derive from the class.
If there are no items set in the , the is zero. If there are items set in the , the is the same as the property on the collection.
Gets the number of list items in the control.
Property
System.Web.UI.WebControls.RepeatLayout
To be added: an object of type 'RepeatLayout'
For information about the available options, see the enumeration.
Two options are new as of ASP.NET 4: and .
Some settings do not allow horizontal layout. For more information, see the enumeration.
Gets or sets a value that specifies whether the list will be rendered by using a table element, a ul element, an ol element, or a span element.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(System.Web.UI.WebControls.RepeatLayout.Table)
Method
1.0.5000.0
2.0.0.0
System.Boolean
Typically, you should use the method to process posted data for a object.
The method is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Processes posted data for the control.
true if the server control's state changes as a result of the postback; otherwise, false.
The key identifier for the control, used to index the .
A object that contains value information indexed by control identifiers.
Method
1.0.5000.0
2.0.0.0
System.Void
Typically, you should use the method to raise an event when the posted data for a object changes.
The method is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Raised when posted data for a control has changed.
Method
1.0.5000.0
2.0.0.0
System.Web.UI.WebControls.Style
Typically, you should use the method to retrieve the style of an item in a object.
The method is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
For a description of this member, see .
A object that represents the style of the specified item type at the specified index in the list control.
One of the enumeration values.
An ordinal index that specifies the location of the item in the list control.
Property
1.0.5000.0
2.0.0.0
System.Boolean
To be added.
Typically, you should use the property to determine if a object contains a footer section.
The member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Gets a value that indicates whether the list control contains a footer section.
Property
1.0.5000.0
2.0.0.0
System.Boolean
To be added.
Typically, you should use the property to determine a object contains a heading section.
The member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Gets a value that indicates whether the list control contains a heading section.
Property
1.0.5000.0
2.0.0.0
System.Boolean
To be added.
Typically, you should use the property to determine whether a object contains a separator.
The member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Gets a value that indicates whether the list control contains a separator between items in the list.
Method
1.0.5000.0
2.0.0.0
System.Void
Typically, you should use the method to render items in a object.
The method is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
For a description of this member, see .
One of the enumeration values.
An ordinal index that specifies the location of the item in the list control.
A object that represents the information used to render the item in the list.
An object that represents the output stream to render HTML content on the client.
Property
1.0.5000.0
2.0.0.0
System.Int32
To be added.
Typically, you should use the property to determine the number of items in a object.
The member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.
Gets the number of items in the list control.
Property
System.Web.UI.WebControls.TextAlign
To be added: an object of type 'TextAlign'
Use this property to specify whether the text associated with the check boxes appears on the left or right of the check box. If this property is set to TextAlign.Right, the text is displayed to the right of the check box. If this property is set to TextAlign.Left, the text is displayed to the left of the check box.
Gets or sets the text alignment for the check boxes within the group.
1.0.5000.0
2.0.0.0
System.ComponentModel.DefaultValue(System.Web.UI.WebControls.TextAlign.Right)
Method
2.0.0.0
System.Void
To be added.
To be added.