简体   繁体   中英

VB.NET Create two column CheckboxList

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

尝试类似的东西:

<asp:checkboxlist id="CheckBoxList1" runat="server" RepeatLayout="table" RepeatColumns="2" RepeatDirection="vertical"/>

使用RepeatDirectionRepeatColumnsRepeatLayout

<asp:CheckBoxList RepeatDirection="Horizontal" RepeatColumns="2" RepeatLayout="Table" ...>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM