CheckBoxList RepeatColumns in asp.net c#

Repeat columns feature in CheckBoxList
CheckBoxList is an asp.net web server control that render a multi-selection check box group in web browser. we can populate a checkboxlist by binding it with data source such as array, SqlDataSource, ObjectDataSource etc. so in a checkboxlist may contains lots of list items.

checkboxlist RepeatColumns property get or set the number of columns to display in the checkboxlist control. this property value type is System.Int32. so we can simply assign an integer number for this property value. as example if we set the RepeatColumns property value to 5 then the checkboxlist items will be display in five columns. we need to set the checkboxlist RepeatLayout property value to 'Table' to work this RepeatColumns property properly.

the following asp.net c# example code demonstrate us how can we use the checkboxlist RepeatColumns property in an asp.net application.
CheckBoxListReapetColumns.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        CheckBoxList1.RepeatColumns = 2;
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        CheckBoxList1.RepeatColumns = 3;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use RepeatColumns (repeat columns) feature in CheckBoxList</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Green">CheckBoxList: Change RepeatColumns</h2>
        <asp:Label 
             ID="Label1"
             runat="server"
             Font-Bold="true"
             ForeColor="SteelBlue"
             Text="asp.net controls"
             >
        </asp:Label>
        <asp:CheckBoxList 
             ID="CheckBoxList1"
             runat="server"
             BackColor="SteelBlue"
             ForeColor="Snow"
             >
             <asp:ListItem>DataList</asp:ListItem>
             <asp:ListItem>Timer</asp:ListItem>
             <asp:ListItem>UpdatePanel</asp:ListItem>
             <asp:ListItem>LinqDataSource</asp:ListItem>
             <asp:ListItem>SqlDataSource</asp:ListItem>
        </asp:CheckBoxList>
        <br /><br />
        <asp:Button 
             ID="Button1"
             runat="server"
             Font-Bold="true"
             ForeColor="SteelBlue"
             Text="RepeatColumns 2"
             OnClick="Button1_Click"
             />
        <asp:Button 
             ID="Button2"
             runat="server"
             Font-Bold="true"
             ForeColor="SteelBlue"
             Text="RepeatColumns 3"
             OnClick="Button2_Click"
             />
    </div>
    </form>
</body>
</html>
More asp.net examples