It's easy to do this validation server side, but I am assuming you want to do it client side?
So the if condition in your code would like this If CType(Me. I had taken the .checked out earlier because I previously was getting a different error that said I couldn't use .checked with something I was doing.
In the spirit of asp.net's validation controls can I use to enforce this. Give all your checkboxes a class name say 'reasons'.
I'm also using the Ajax validation extender, so it would be nice if it could look like other controls, and not some cheesy server validate method in the codebehind. $('.reasons :checked').length == 0 means that user didn't select any checkbox and you can display an error.
However, in certain cases you may want to use validation on a checkbox such as one that would require them to accept the terms and services of a web site or registration process.
If it is, then we change Is Valid to true, if it is not we change Is Valid to false.
You can perform custom validation when you submit the form and prevent submitting if there are no checked checkboxes.
Thanks, Laura Hi Laura, You should be using the Checked property of the Check Box control. Checked Then Hope this helps to solve your problem Good Luck [yes] Regards Vineed thanks, i can't believe I spent so much time on that.
Now you can ask questions directly to me on my new site ASPForums.
In this article we learn how to validate a Radio Button List and a Drop Down List using Java Script in ASP. Java Script provides a way to validate a form's data on the client's computer before sending it to the web server.
If we try to perform all the validation on the server side then naturally the server is will take time to process the details and finally it will give a response to the client.