ASP.NET CheckBoxList Control Department of Computer WEB – GRADE 5 Lecturer. OMEED M. M Lecture 8
CheckBoxList Control • CheckBoxList is collection of ListItem objects. How we can add items to the checkboxlist? • Items can be added to the CheckBoxList in the HTML source or in the code behind file. 4/6/2022 Mr.Omeed M. M 2
Important Properties of the CheckBox Control 4/6/2022 Mr.Omeed M. M 3 This is CheckBoxList This is collection of single CheckBox
Adding items through HTML source 4/6/2022 Mr.Omeed M. M 4 <asp:CheckBoxList ID="checkboxListEducation" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Diploma" Value="1"></asp:ListItem> <asp:ListItem Text="Graduate" Value="2"></asp:ListItem> <asp:ListItem Text="Post Graduate" Value="3"></asp:ListItem> <asp:ListItem Text="Doctrate" Value="4"></asp:ListItem> </asp:CheckBoxList> <br /> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
Important Properties of the CheckBox Control 4/6/2022 Mr.Omeed M. M 5 RepeatColumns property specifies the number of columns used to lay out the items. SelectedIndex property of the CheckBoxList control can also be used to get the index of the selected item in the checkboxlist. But this property, returns only one selected item, and that too, the item with the lowest index. SelectedIndex property returns -1, if nothing is selected. SelectedValue property returns the selected Item's value, but only for one selected item. If no item is selected this property returns empty string.
Any Questions? 4/6/2022 6 MR. OMEED M. MOHAMMED

Asp.net CheckBoxList control

  • 1.
    ASP.NET CheckBoxList Control Department ofComputer WEB – GRADE 5 Lecturer. OMEED M. M Lecture 8
  • 2.
    CheckBoxList Control • CheckBoxListis collection of ListItem objects. How we can add items to the checkboxlist? • Items can be added to the CheckBoxList in the HTML source or in the code behind file. 4/6/2022 Mr.Omeed M. M 2
  • 3.
    Important Properties ofthe CheckBox Control 4/6/2022 Mr.Omeed M. M 3 This is CheckBoxList This is collection of single CheckBox
  • 4.
    Adding items throughHTML source 4/6/2022 Mr.Omeed M. M 4 <asp:CheckBoxList ID="checkboxListEducation" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Diploma" Value="1"></asp:ListItem> <asp:ListItem Text="Graduate" Value="2"></asp:ListItem> <asp:ListItem Text="Post Graduate" Value="3"></asp:ListItem> <asp:ListItem Text="Doctrate" Value="4"></asp:ListItem> </asp:CheckBoxList> <br /> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
  • 5.
    Important Properties ofthe CheckBox Control 4/6/2022 Mr.Omeed M. M 5 RepeatColumns property specifies the number of columns used to lay out the items. SelectedIndex property of the CheckBoxList control can also be used to get the index of the selected item in the checkboxlist. But this property, returns only one selected item, and that too, the item with the lowest index. SelectedIndex property returns -1, if nothing is selected. SelectedValue property returns the selected Item's value, but only for one selected item. If no item is selected this property returns empty string.
  • 6.