Click here to Skip to main content
15,905,612 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted

1 solution

Hi ,

Try with this

make Auto postback true to first checklistbox. then write this code selected indexchenged event

VB
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
 
Share this answer
 
Comments
soniya sangal 5-Nov-11 0:48am    
thanx

exactly i am doing this same its work only first time..
if we select a thn 1 is checked
thn if we select b thn 2 is not checkd....bcoz of autopostback

pls give me solution of that problm

thnx
palraj001 5-Nov-11 0:52am    
its woking here, did u try with this code?
soniya sangal 5-Nov-11 1:02am    
i dont want all item is checked of 2nd checkboxlist on the singel selection of checkbox

i want particular checkox is checked

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900