vs2005中,将CheckboxList1中选定项删除,并在CheckboxList2中增加此项,
出现以下问题:
选中CheckboxList1中某项,点击button,无任何反应,系统认为未选中任何项,if内代码根本不运行;再选CheckboxList1某项,点击button,才能正常运行。
不知道是不是bug?
以下button的点击事件代码: Dim iCount As Integer = CheckboxList1.Items.Count
Dim i As Integer
For i = (iCount - 1) To 0 Step -1
If CheckboxList1.Items(i).Selected Then
Dim myItem As New System.Web.UI.WebControls.ListItem
myItem.Text = CheckboxList1.Items.Item(i).Text
myItem.Value = CheckboxList1.Items.Item(i).Value
CheckboxList1.Items.Remove(myItem)
CheckBoxList2.Items.Add(myItem)
End If
Next
出现以下问题:
选中CheckboxList1中某项,点击button,无任何反应,系统认为未选中任何项,if内代码根本不运行;再选CheckboxList1某项,点击button,才能正常运行。
不知道是不是bug?
以下button的点击事件代码: Dim iCount As Integer = CheckboxList1.Items.Count
Dim i As Integer
For i = (iCount - 1) To 0 Step -1
If CheckboxList1.Items(i).Selected Then
Dim myItem As New System.Web.UI.WebControls.ListItem
myItem.Text = CheckboxList1.Items.Item(i).Text
myItem.Value = CheckboxList1.Items.Item(i).Value
CheckboxList1.Items.Remove(myItem)
CheckBoxList2.Items.Add(myItem)
End If
Next
Dim i As Integer
For i = (iCount - 1) To 0 Step -1
If CheckboxList1.Items(i).Selected Then
CheckBoxList2.Items.Add(CheckboxList1.Items(i))
CheckboxList1.Items.RemoveAt(i);
End If
Next
不会VB 应该是这样 吧
你调一下看能走到那步?