Working with the CheckBoxList ControlThe CheckBoxList control renders a list of check boxes. The check boxes can be rendered horizontally or vertically. Unlike the other List controls, a user always can select multiple items when using a CheckBoxList control. For example, the page in Listing 10.13 contains a CheckBoxList control that renders its list items in two columns (see Figure 10.12). Figure 10.12. Displaying list items with the CheckBoxList control.![]() Listing 10.13. ShowCheckBoxList.aspx
When you click the Submit button, the values of the Text property of any selected check boxes are displayed in a Label control. The selected check boxes are retrieved from the CheckBoxList control's Items property. The CheckBoxList control includes three properties that affect its layout:
Normally, a CheckBoxList control renders its list items in an HTML table. When the RepeatLayout property is set to the value Flow, the items are not rendered in a table. |