Adding ListItems Declararatively : CheckBoxList « ASP.net Controls « ASP.NET Tutorial






<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>CheckBoxList Control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <h1>CheckBoxList Control</h1>
    <h2>Adding ListItems Declararatively</h2>
     <asp:CheckBoxList ID="cblItems" runat="server" AutoPostBack="True" CellPadding="5" CellSpacing="10" RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Flow" TextAlign="Left">
         <asp:ListItem> Item 1 </asp:ListItem>   
         <asp:ListItem> Item 2 </asp:ListItem>
         <asp:ListItem> Item 3 </asp:ListItem>
         <asp:ListItem> Item 5 </asp:ListItem>
         <asp:ListItem> Item 6 </asp:ListItem>
     </asp:CheckBoxList>
    
    </div>
    </form>
</body>
</html>








3.12.CheckBoxList
3.12.1.Fill data into asp:CheckBoxList and get selected items (C#)
3.12.2.Adding ListItems from an Array
3.12.3.Adding ListItems from an Array With a Value
3.12.4.Adding ListItems from an Array Using DataBinding
3.12.5.Adding ListItems Declararatively