ASP.NET CheckBoxList 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
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
For a full description, visit the Web Control Standard Attributes .
Control Standard Properties
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 control