Peanuts, I just ran into the same problem as you. On the client side, I have javascript that disables the necessary field validators depending on their choice in the user interface. However, server-side validation still worked.
At boot time, I added a method to disable my validators using the same rules as javascript. In my case, it depended on the user choosing the switch:
this.requiredValidator.Enabled = this.myRadioButton.Checked;
This seems to work on a SECOND boot, but not in the first place. After debugging, I found that the wrong radio button is considered verified when this line is run. The view / publish state was not applied to the control at the moment when I checked it to disable my validator. The reason I posted this at boot time was to make sure I turned off the validator before it started.
So, it looks like the solution is similar to the line above AFTER ViewState, but before the checks.
Overloading the Validate () method, as suggested by palehorse, worked and allowed me to make sure that server-side validators were enabled / disabled based on the user's current choices.
Jay s
source share