CheckBoxList RepeatLayout Flow in asp.net c#

CheckBoxList RepeatLayout Flow
The following asp.net c# example code demonstrate us how can we use CheckboxList RepeatLayout Flow. CheckBoxList is an asp.net list web server control. CheckBoxList RepeatLayout property allow us to specify whether list will be rendered in web browser by using a html 'table' element, a 'ul' element, a 'ol' element or a 'span' element.

We can set or change CheckBoxList RepeatLayout property value programmatically by selecting a value from System.Web.UI.WebControls.RepeatLayout enumeration. RepeatLayout enumeration have four values those are Flow, OrderedList, Table and UnorderedList. We can choose any one value from this enumeration for CheckBoxList RepeatLayout.

CheckBoxList RepeatLayout Flow display CheckBoxList items without a table structure. In this layout mode, each item is render in web browser by a html 'span' element and items are separated by html 'br' (break) tag.
CheckBoxListRepeatLayoutFlow.aspx

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

<!DOCTYPE html>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use CheckBoxList RepeatLayout Flow in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:OrangeRed; font-style:italic;">
            How to use CheckBoxList
            <br /> RepeatLayout Flow in asp.net
        </h2>
        <hr width="450" align="left" color="SkyBlue" />
        <asp:CheckBoxList
             ID="CheckBoxList1"
             runat="server"
             Font-Size="Large"
             Font-Underline="true"
             Font-Names="Courier New"
             Font-Italic="true"
             ForeColor="DarkCyan"
             BorderWidth="2"
             BorderColor="Pink"
             RepeatColumns="2"
             Font-Bold="true"
             >
             <asp:ListItem Text="Hippophae rhamnoides"></asp:ListItem>
             <asp:ListItem Text="Honeysuckle"></asp:ListItem>
             <asp:ListItem Text="Ilex aquifolium"></asp:ListItem>
             <asp:ListItem Text="Laburnum anagyroides"></asp:ListItem>
             <asp:ListItem Text="Ligustrum vulgare"></asp:ListItem>
        </asp:CheckBoxList>
        <br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Set CheckBoxList RepeatLayout Flow"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples