2011-10-19 58 views
8

我的下面的代碼將100個項目拖入checkboxlist列成一列。 如何修改代碼使其顯示爲兩列?謝謝!VB.NET創建兩列CheckboxList

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 
+0

什麼是CheckBoxList1?什麼類型的容器等? – Purplegoldfish

回答

14

試着這麼做:

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

使用RepeatDirectionRepeatColumnsRepeatLayout

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