Is there away to call a javascript function after a validation control fails validation?
+1
A:
Check article "ASP.NET Validation in Depth" from MSDN - section of particular interest is Client Side Validation that provides client side API. You can use isvalid property of a validator object to decide if its valid or not. Validator objects (on client side) can be referred using ClientID property of server side validator control.
One of the way to achieve what you want can be
- Turn off ASP.NET validation by setting js variable
Page_ValidationActive
to false - When post-back happens iterate via all validators using
Page_Validators
property and validate each callingValidatorValidate
. - If validator of interest in not valid then call your function.
VinayC
2010-09-16 08:36:31