All you have to do is define the callback method in the ClientValidationFunction property of the CustomValidator definition:
<asp:CustomValidator id="CustomValidator1" ... ClientValidationFunction="ClientValidationFunction" />
Then you can define a client-side check script:
<script language="javascript"> function ClientValidationFunction(sender, args){ var valid = false; </script>
Update: the sender variable contains a link to the validation user control - since JavaScript is dynamically typed, we can simply update its errormessage property directly:
sender.errormessage = "This is a new validation message";
source share