Latest web development tutorials

ASP.NET CheckBoxList control

Web Server Controls Web server control

Definition and Usage

CheckBoxList control is used to create multiple choice box group.

Each CheckBoxList control options are available as defined by a ListItem element!

Note: The control supports data binding!


Attributes

属性 描述 .NET
CellPadding 表格单元格的边框与内容之间的像素数。 1.0
CellSpacing 表格单元格之间的像素数。 1.0
RepeatColumns 当显示复选框组时所用的列数。 1.0
RepeatDirection 规定复选框组水平重复还是垂直重复。 1.0
RepeatLayout 复选框组的布局。 1.0
runat 规定该控件是服务器控件。必须设置为 "server"。 1.0
TextAlign 文本出现在复选框的哪一侧。 1.0

ListControl standard attributes

AppendDataBoundItems, AutoPostBack, CausesValidation, DataTextField, DataTextFormatString, DataValueField, Items, runat, SelectedIndex, SelectedItem, SelectedValue, TagKey, Text, ValidationGroup, OnSelectedIndexChanged

ListControl control covers all the basic functions of a list control. Controls inherit from this control include: CheckBoxList, DropDownList, ListBox and RadioButtonList control.

For a full description, visit the ListControl standard attributes .

Web Control Standard Properties

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

For a full description, visit the Web Control Standard Attributes .

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a full description, go to Control Standard Attributes .


Examples

CheckBoxList
In this example, we declare a CheckBoxList control in an .aspx file. Then we create an event handler for the SelectedIndexChanged event. The list contains six optional check box. When the user selects one of them, the page will automatically back to the server, and perform Check subroutine. Items that will traverse control subroutine collection and test the Selected property of each item. The selected item is displayed in the Label control.


Web Server Controls Web server control