I\'m using old fashioned ASP.NET validation (ugh) for a checkout process. I have a checkbox -\"I\'ll call with my credit card details\"-. If checked I need to disable the requir
You can disable the validators client-side (in javascript):
function disable(validatorId)
{
var validator = document.getElementById(validatorId);
ValidatorEnable(validator, false);
}
Where validatorId is the clientID of the validator to be disabled. See this page for a complete example.
You can disable the validators server-side:
MyFieldValidator.Enabled = MyCheckBox.Checked
Page.Validate()
If Page.IsValid Then
'stuff
end if
If you're disabling server side then you can do
button1.CausesValidation = False
in your CheckChangedEvent this is more helpful if you have a lot of validators and need to disable them all.