I have a checkboxlist which either displays them in a list
A
B
C
D
or horizontally
A B C D
I want to arrange them in a nice grid like this
A B C D
E F G H
I J K L
How do I do it?
You need to set the RepeatDirection and RepeatColumns properties of the CheckBoxList.
<asp:CheckBoxList ID="myCheckBoxList" runat="server"
RepeatColumns="4" RepeatDirection="Horizontal">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
<asp:ListItem>D</asp:ListItem>
<asp:ListItem>E</asp:ListItem>
<asp:ListItem>F</asp:ListItem>
<asp:ListItem>G</asp:ListItem>
<asp:ListItem>H</asp:ListItem>
<asp:ListItem>I</asp:ListItem>
<asp:ListItem>J</asp:ListItem>
<asp:ListItem>K</asp:ListItem>
<asp:ListItem>L</asp:ListItem>
<asp:ListItem>M</asp:ListItem>
<asp:ListItem>N</asp:ListItem>
<asp:ListItem>O</asp:ListItem>
<asp:ListItem>P</asp:ListItem>
<asp:ListItem>Q</asp:ListItem>
<asp:ListItem>R</asp:ListItem>
<asp:ListItem>S</asp:ListItem>
<asp:ListItem>T</asp:ListItem>
</asp:CheckBoxList>
This will render a 4x5 grid of check boxes.
A B C D
E F G H
I J K L
M N O P
Q R S T
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With