Data Binding ASP.Net Tutorial

Three properties that affect its layout:
RepeatColumns:    The number of columns of check boxes to display.
RepeatDirection:  The direction in which the check boxes are rendered. 
                  Possible values are Horizontal and Vertical.
RepeatLayout:     Determines whether the check boxes are displayed in an HTML table. 
                  Possible values are Table and Flow.
                  
<%@ Page Language="C#" %>
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        foreach (ListItem item in cblProducts.Items)
            if (item.Selected)
                lblProduct.Text += "
  • " + item.Text;
        }



        Show CheckBoxList


        
        

                id="cblProducts"
            DataSourceID="srcProducts"
            DataTextField="Title"
            DataValueField="Id"
            RepeatColumns="2"
            Runat="server" />
        
                id="btnSubmit"
            Text="Submit"
            OnClick="btnSubmit_Click"
            Runat="server" />
        
        
                id="lblProduct"
            EnableViewState="false"
            Runat="server" />
                id="srcProducts"
            SelectCommand="SELECT Id, Title FROM Products"
            ConnectionString="<%$ ConnectionStrings:Products %>"
            Runat="server" />
        

        


          
                
    File: Web.config

      
                 connectionString="Data Source=.\SQLEXPRESS;
             AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" />