I'm using checklistbox. I want to list all items like that checkboxlist

But there 2 selection in repeatdirection. Only horizontal and vertical.

Here is my code:

<asp:CheckBoxList runat="server" RepeatDirection="Horizontal">
    <asp:ListItem Text=" Monday "></asp:ListItem>
    <asp:ListItem Text=" Tuesday "></asp:ListItem>
    <asp:ListItem Text=" Wednesday "></asp:ListItem>
    <asp:ListItem Text=" Thursday "></asp:ListItem>
    <asp:ListItem Text=" Friday "></asp:ListItem>
    <asp:ListItem Text=" Saturday "></asp:ListItem>
    <asp:ListItem Text=" Sunday "></asp:ListItem>
</asp:CheckBoxList>

So I mean that half vertical and half horizontal. When row is full other items will be in next row.

How can I do that?

有帮助吗?

解决方案

you can use this RepeatDirection, RepeatColumns, and RepeatLayout:

<asp:CheckBoxList RepeatDirection="Horizontal" 
        RepeatColumns="2" RepeatLayout="Table" ...>

check more about property here : CheckBoxList Properties

其他提示

.myGroupCheckBox{
            list-style:none;
            width:270px;            
        }
 .myGroupCheckBox li{
            display: inline;
        }
<asp:CheckBoxList ID="CheckBoxList1" runat="server" CssClass="myGroupCheckBox"
            RepeatLayout="UnorderedList">
            <asp:ListItem Text=" Monday "></asp:ListItem>
            <asp:ListItem Text=" Tuesday "></asp:ListItem>
            <asp:ListItem Text=" Wednesday "></asp:ListItem>
            <asp:ListItem Text=" Thursday "></asp:ListItem>
            <asp:ListItem Text=" Friday "></asp:ListItem>
            <asp:ListItem Text=" Saturday "></asp:ListItem>
            <asp:ListItem Text=" Sunday "></asp:ListItem>
        </asp:CheckBoxList>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top