Name
CheckBoxList
Synopsis
This class represents a list of checkboxes that can be selected in any combination.
Though this class is generated out of individual checkboxes, it acts like an
integrated list. For example, ASP.NET will add or remove checkbox items as needed
when you bind it to a data source. You can use RepeatDirection to specify
how checkboxes will be grouped together if RepeatColumns is greater
than 1. For example, if you set RepeatDirection to RepeatDirection.Vertical, and RepeatColumns to 2, the
first two list items will be displayed in the first columns, the next two will be
displayed on the second column, and so on. If you set RepeatDirection to RepeatDirection.Horizontal, your list
will still have the same number of rows and columns, but checkbox items will be
filled first by column, and then by row.
Individual checkboxes are grouped together automatically in an HTML table, which you
can fine-tune with the CellPadding and CellSpacing properties.
Alternatively, you can set RepeatLayout to RepeatLayout.Flow to specify that an
HTML table should not be used.
Most of the list-specific functionality, such as determining the selected item and
reacting to a SelectedIndexChanged event,
is provided by the ListControl class,
which CheckBoxList inherits from. To
determine what items are checked in a checkbox list, iterate through the Items collection and test
the ListItem.Selected property of each item in the list.
Public Class CheckBoxList : Inherits ListControl : Implements_ ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access