How to manage ASP.NET Validator Controls Client Side Validation with JavaScript?
1 answer
If you mean to write custom client side validation functions, this is fully supported by CustomValidator. Just give it the name of your javascript function you want to use for validation, for example:
<script language="javascript">
function MyTextBoxValidation(source, args)
{
if (valid)
args.IsValid = true;
else
args.IsValid = false;
}
</script>
<asp:CustomValidator ID="MyValidator" runat="server"
ClientValidationFunction="MyTextBoxValidation"
ControlToValidate="MyTextBox" />
If, however, you just want to disable existing validation logic, you can always use the following script:
if (Page_ClientValidate())
{
// Do stuff, we're valid here.
}
+1
a source to share