ASP.NET CheckBoxList control.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
The ASP.NET CheckBoxList control is used to create a multiple selection of checkboxes within a group. The group is rendered as a
HTML Table element, the checkboxes within the list are rendered as
HTML input element type checkbox and the text fields associated with the checkboxes are rendered as HTML label elements.
Working example.
Example code.
Creating the CheckBoxList control.
< asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>DELL</asp:ListItem>
<asp:ListItem>HP Computers</asp:ListItem>
<asp:ListItem>SONY</asp:ListItem>
<asp:ListItem>ACER</asp:ListItem>
</asp:CheckBoxList>
The above example will be rendered as HTML with the result below (source).
<table id="CheckBoxList1" border="0"> <tr> <td><input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" /><label for="CheckBoxList1_0">DELL</label></td> </tr><tr> <td><input id="CheckBoxList1_1" type="checkbox" name="CheckBoxList1$1" /><label for="CheckBoxList1_1">HP Computers</label></td> </tr><tr> <td><input id="CheckBoxList1_2" type="checkbox" name="CheckBoxList1$2" /><label for="CheckBoxList1_2">SONY</label></td> </tr><tr> <td><input id="CheckBoxList1_3" type="checkbox" name="CheckBoxList1$3" /><label for="CheckBoxList1_3">ACER</label></td> </tr> </table>
|