The CheckBoxList Web Control

The CheckBoxList control is a single control that acts as a parent control for a collection of checkable list items, each of which is rendered through an individual CheckBox control. You insert a check box list as follows:

<asp:CheckBoxList runat="server" id="cbEmployees">

The CheckBoxList control supports data binding by using five properties: DataSource, DataMember, DataTextField, DataValueField, and DataTextFormatString. You bind the CheckBoxList control to a data source by using the following code:

cbEmployees.DataSource = oDS.Tables["EmployeesList"];
cbEmployees.DataTextField = "lastname";
cbEmployees.DataValueField = "employeeid";

The properties of the CheckBoxList control play the same role as the properties ...

Get Building Web Solutions with ASP.NET and ADO.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.