Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have a checkbox list in application. Now i need to know if there is an item that is selected which will be my basis for my IF/ELSE condition.

I need server-side validation here and not client-side.

Please help me!

1 solution


Create a method that will return a Boolean value and name it as IsValid. The add the following codes in it.

retval = false
foreach(ListItem chk in CheckBoxList1.Items)
   if(chk.Checked == false)
   if(chk.Checked == true)
      return true;
return retval;

Share this answer
[no name] 13-Dec-11 20:32pm    
thank u for deducting 16 consecutive pts whoever u are! hater! :)

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