Furkan Ayık Furkan Ayık - 1 month ago 5
ASP.NET (C#) Question

Making asp:CheckBoxList Items Side By Side

I have a problem and i couldn't find the solution on web. I'm using asp CheckBoxList but i have too many data to list. I want to list items like in 2 column in box area. I'm sharing an image. Please check it out. So how can i do something like that?

enter image description here

The important thing is; this checkboxlist filling dynamically from code behind. I dont have ListItem on html page. So i cant style them. Any idea?

<asp:CheckBoxList ID="AreaCheckBoxes" runat=server>

</asp:CheckBoxList>

Answer

You can set the RepeatColumns property to 2 and the RepeatLayout property to Table.

<asp:CheckBoxList ID="AreaCheckBoxes" 
                  RepeatColumns="2" 
                  RepeatLayout="Table" 
                  RepeatDirection="Vertical"
                  runat=server>
</asp:CheckBoxList>
Comments