复选框的复选框上选中复选框 [英] checkbox is checked of checkboxlist on the checked of checkbox
本文介绍了复选框的复选框上选中复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是...
我有2个复选框列表
我希望如果在复选框列表中选中了一项,那么在第二个复选框列表中选中了某项
复选框列表是
ci和c2
c1项是a,b,c
c2项是1,2,3
我希望如果a被选中,则thn 1是自动检查的,b是否被选中,thn 2,是自动检查的,等等....
thanx
my problem is...
i have 2 checkbox list
i want that if 1 item is checked in the checkboxlist thn thn some item is checked in the 2 checkbox list
checkboxlist are
ci and c2
c1 item is a,b,c
c2 item is 1,2,3
i want that if a is checked thn 1 is automaticaly check and if b is checked thn 2 is automaticaly check and so on....
thanx
推荐答案
试试这个
将自动回发设为第一个复选框为true.然后将这段代码写成选中的indexchenged事件
Hi ,
Try with this
make Auto postback true to first checklistbox. then write this code selected indexchenged event
Protected Sub CheckBoxList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBoxList1.SelectedIndexChanged
For i As Integer = 0 To CheckBoxList1.Items.Count - 1
If CheckBoxList1.Items(i).Selected = True Then
CheckBoxList2.Items(i).Selected = True
Else
CheckBoxList2.Items(i).Selected = False
End If
Next
End Sub
问候,
朋友
Regards,
Pal
这篇关于复选框的复选框上选中复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文