Is there any way that I can wrap a checkboxlist in asp.net so that lets say if you have 20 checkboxes in your list, there are two columns of 10. Example:
Box Box
Box Box
Box Box
Box Box
Box Box
Box Box
Box Box
Box Box
My current code is just:
<asp:CheckBoxList ID="Numbers" runat="server" AutoPostBack = "true">
<asp:ListItem> 1 </asp:ListItem>
<asp:ListItem> 2 </asp:ListItem>
<asp:ListItem> 3 </asp:ListItem>
<asp:ListItem> 4 </asp:ListItem>
<asp:ListItem> 5 </asp:ListItem>
<asp:ListItem> 6 </asp:ListItem>
<asp:ListItem> 7 </asp:ListItem>
<asp:ListItem> 8 </asp:ListItem>
<asp:ListItem> 9 </asp:ListItem>
...ect
</asp:CheckBoxList>
I figure there must be some sort of asp markup or something to allow me to cleanup this list of checkboxes.
What you are looking for is the
RepeatColumnsproperty and theRepeatDirectionproperty. Something like this:As per the below reference, you can also set this property programmatically in your code-behind utilizing the
RepeatDirectionenum:Please see this as a reference: How to: Set Layout in a CheckBoxList Web Server Control