Great, now we have it working on the server, but how do we get this working with client validation?The first step is to reference the appropriate scripts.We can test this out quickly by creating a view model and applying this attribute to the model. We haven’t enabled client validation yet, but let’s see what happens when we view this page and try to submit some values.
If you you’re using another model validation provider such as the one for the Enterprise Library’s Validation Block, it might have its own means of registration.
Now when I run the demo, I can see validation take effect as I tab out of each field.
That’s how we hook up this client function to the server validation attribute.
You’ll notice that the function we add to the validators itself returns a function which does the actual validation.
In the Page_Load Event of this page write the following statement: accept Button. Add("onclick", "return Validate()") Here Validate() is a simple function written in Java Script or VBScript.