【问题标题】:VB.NET Create two column CheckboxListVB.NET 创建两列 CheckboxList
【发布时间】:2011-10-19 15:20:50
【问题描述】:

我下面的代码将 100 项放入复选框列表中,全部放在一列中。 如何修改代码使其显示为两列?谢谢!

    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

【问题讨论】:

  • 什么是 CheckBoxList1?什么类型的容器等?

标签: asp.net vb.net


【解决方案1】:

尝试类似:

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

【讨论】:

    【解决方案2】:

    使用RepeatDirectionRepeatColumnsRepeatLayout

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多