ASP.NET:指定的CheckBoxList列数 [英] ASP.NET: CheckBoxList specify number of columns
本文介绍了ASP.NET:指定的CheckBoxList列数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何指定我想在一个的CheckBoxList两列?
下面是我的code:
保护小组的Page_Load(BYVAL发件人为对象,BYVAL E上System.EventArgs)把手Me.Load
如果没有Page.IsPostBack然后
昏暗迪作为新IO.DirectoryInfo(\\\\ bk00app0001 \\影像\\)
昏暗imageArray作为IO.FileInfo()= di.GetFiles()
昏暗的形象IO.FileInfo 列出所有映像的名称在指定的目录 对于每个图像中imageArray
CheckBoxList1.Items.Add(image.Name)
下一个
万一
结束小组保护小组btnDelete_Click(BYVAL发件人为对象,BYVAL E上EventArgs的)把手btnDelete.Click 对于数量为整数= 0〜CheckBoxList1.Items.Count - 1
如果CheckBoxList1.Items(计数).Selected然后
File.Delete(\\\\ bk00app0001 \\图片\\&放大器; CheckBoxList1.Items(计数)的ToString)
CheckBoxList1.Items.Remove(计数)
万一
下一个 的Response.Redirect(Delete.aspx)结束小组
解决方案
设置<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.repeatdirection.aspx\"相对=nofollow> CheckBoxList.RepeatDirection
和<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.repeatcolumns.aspx\"相对=nofollow> CheckBoxList.RepeatColumns
根据您的要求。
How do I specify that I want two columns on a checkboxlist? Below is my code:
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("\\bk00app0001\Images\")
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
CheckBoxList1.Items.Add(image.Name)
Next
End If
End Sub
Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click
For count As Integer = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(count).Selected Then
File.Delete("\\bk00app0001\Images\" & CheckBoxList1.Items(count).ToString)
CheckBoxList1.Items.Remove(count)
End If
Next
Response.Redirect("Delete.aspx")
End Sub
解决方案
Set CheckBoxList.RepeatDirection
and CheckBoxList.RepeatColumns
as you require.
这篇关于ASP.NET:指定的CheckBoxList列数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文