How to: Add CheckBoxList Web Server Controls to a Web Forms Page
When you use a CheckBoxList control, you add a single control to the page. Adding items to the control is a separate process that depends on whether you will display a static list in the control or display a list that is generated dynamically at run time.
Note |
---|
The procedure for working with individual CheckBox Web server controls is different. For details, see How to: Add CheckBox Web Server Controls to a Web Forms Page. |
To add a CheckBoxList Web server control to a Web Forms page
Add an
<asp:CheckBoxList>
element to the page. For syntax, see CheckBoxList Web Server Control Declarative Syntax.Optionally, change the orientation of the caption by setting the TextAlign property.
Optionally, change the RepeatLayout, RepeatColumns, RepeatDirection property to specify whether the control displays multiple columns.
Create items for the control in one of these ways:
By creating them as individual items. For details, see How to: Add Items in List Web Server Controls.
By binding data to the control. For details, see How to: Populate List Web Server Controls from a Data Source.