Click here to Skip to main content
15,945,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having two check box lists by the side , basically two columns of lists. So if the user click the check boxes which are by the side of each other at the same time it should not let them do it instead let them only select one chek box.How do I code for that?
Thank you
Posted

1 solution

C#
for (int cbkNum = 0; cbkNum < CheckBoxList1.Items.Count; cbkNum++)
{
   if (CheckBoxList1.Item[cbkNum].Selected)
       CheckBoxList2.Item[cbkNum].Enabled = false;
   else
       CheckBoxList2.Item[cbkNum].Enabled = true;
}


and the same routine for CheckBoxList2 whic enables or disables item in CheckBoxList1 of course
 
Share this answer
 

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