Monday, November 9, 2009

CustomValidator for Checkboxes in ASP.NET

To check that a checkbox is set in ASP.NET you need to do a little more than just grab a RequiredFieldValidator.Situation:

The RequiredFieldVadlidator cannot be used to validate ASP.NET Checkboxes.


Use a CustomValidator. All you need is implement the ServerValidate event of the Custom Validator to validate that the check-box is checked/unchecked. Read more:

No comments: