Reputation: 6469
My below code pulls in 100 items into the checkboxlist all into one column. How can I modify the code so it will appear as two columns? Thanks!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim di As New IO.DirectoryInfo(ImagePath)
Dim imageArray As IO.FileInfo() = di.GetFiles()
Dim image As IO.FileInfo
'list the names of all images in the specified directory
For Each image In imageArray.OrderBy(Function(i) i.Name)
CheckBoxList1.Items.Add(image.Name)
Next
End If
End Sub
Upvotes: 8
Views: 10258
Reputation: 46077
Use RepeatDirection
, RepeatColumns
, and RepeatLayout
:
<asp:CheckBoxList RepeatDirection="Horizontal" RepeatColumns="2" RepeatLayout="Table" ...>
Upvotes: 1
Reputation: 1566
Try something like:
<asp:checkboxlist id="CheckBoxList1" runat="server" RepeatLayout="table" RepeatColumns="2" RepeatDirection="vertical"/>
Upvotes: 18