Validating ASP.NET checkbox (and similar) controls. There are controls in the .NET framework that can not be wired to the standard validation controls. The checkbox control is one example. You can’t use the requiredfieldvalidator because it has a value. It’s either true or false. And you can’t provide a regularexpressionvalidator or one of the others because it is a boolean value. So, if I want to make sure a check box is checked before the user continues, for example. And, I want to make sure that the error message shows up in the error summary control like every other error, how do I do that?

11 thoughts on “Validating ASP.NET checkbox (and similar) controls.”

  1. You shouldn’t be using the “ControlToValidate” property. It isn’t needed and it WILL cause an error if you do. This was covered in the video

  2. .Net FAIL

    Control ‘CheckBox27’ referenced by the ControlToValidate property of ‘CustomValidator1’ cannot be validated.

  3. Thank you very much for the information, but why wouldn’t you just use:

    args.IsValid = Checkbox1.Checked

    Seems much simpler.

    Anyway, thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *