Asp.net Checkbox List

Checkbox list Define:

In an asp.net, CheckBox web server control.checkbox allow to user to select (check) more than one true or false condition. so the checklist control create a list of checkbox on web forms page.  

CheckboxList Declaration: 

<asp:CheckBoxList ID="CheckBoxList2" runat="server">
        </asp:CheckBoxList> 

ID “checkboxlist2” is use to Access control for C# programming Language.


Check list how to Use in Asp.net :

List control use for multi selection. If we want to select many options at same time. Then we use Checkboxlist control. For This control here we define a List control with list of some languages.

<asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="234px"
            Width="125px">
            <asp:ListItem>Hindi</asp:ListItem>
            <asp:ListItem>English</asp:ListItem>
            <asp:ListItem>Spanish</asp:ListItem>
            <asp:ListItem>Finnish</asp:ListItem>
            <asp:ListItem>Cebuano</asp:ListItem>
        </asp:CheckBoxList>

             Here five languages bind statically in this checkbox List. For add item in list control we    use <asp:ListItem> tag .

Other related web control:

CheckboxList Access using JavaScript:

Var chbl1=document.getbyID(‘<%ControlID%>);
Here chbl1 is JavaScript variable.

Inheritance Class  Hierarchy:

 Listbox Class Hierarchy As given here
System.Object Class(Main Class or Root Class)
      System.Web.UI.Control(super class of all control class)
            WebControls.WebControl
              BaseDataBoundControl
                  WebControls.DataBoundControl
                      WebControls.ListControl
                           WebControls.CheckBoxList

Listbox Constructors:

There is one constructors checkboxList(), User to create new object of checklist class. 

Properties of CheckboxList:

There is fallowing Properties include check list these are given As.

CheckboxList Control Standard Properties:

Horizontal CheckboxList:
<asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="99px"
            Width="125px" RepeatDirection="Horizontal">
            <asp:ListItem>Hindi</asp:ListItem>
            <asp:ListItem>English</asp:ListItem>
            <asp:ListItem>Spanish</asp:ListItem>
            <asp:ListItem>Finnish</asp:ListItem>
            <asp:ListItem>Cebuano</asp:ListItem>
        </asp:CheckBoxList> 


Vertical CheckboxList:
<asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="99px"
            Width="125px">
            <asp:ListItem>Hindi</asp:ListItem>
            <asp:ListItem>English</asp:ListItem>
            <asp:ListItem>Spanish</asp:ListItem>
            <asp:ListItem>Finnish</asp:ListItem>
            <asp:ListItem>Cebuano</asp:ListItem>
        </asp:CheckBoxList>