문제

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