views:

631

answers:

0

I know that if you instantiate and asp:CustomValidator control, you in most cases need to check for IsValid in the custom validator function if you want to respect other validators on the page.

However, if you write you own Custom Validator, inherit from BaseValidator or RequiredFieldValidator, I don't see any way to check for IsValid (in EvaluateIsValid, presumably). It seems to happen automatically.

In this particular case, I have several required fields and a checkbox. When the checkbox is checked and a couple of other things are true, I want to ignore the requiredfieldvalidators.

If I was handling this in a asp:CustomValidator code, I just would not check for IsValid before running my validator. Then, when the validator returns true, the Page.IsValid is true, and my form will submit.

Help?

Note: no javascript is allowed in this application. I don't have it turned off, either.
Note2: I actually got it working, but I'm not sure why it's working the way it does. When my customvalidator passess, the requiredfieldvalidators automatically do not fire and the form submits. But how would I do it if I didn't want this functionality?