Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET having a checkboxlist with my nice checkboxes in a 4x5 grid

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?

like image 694
NibblyPig Avatar asked Jan 23 '23 02:01

NibblyPig


1 Answers

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
like image 83
Phaedrus Avatar answered Jan 27 '23 04:01

Phaedrus