Reputation: 129
I am very new to MVC and I am using MVC 3 in our Project..
I implemented Model level validation using IValidateObject..and I created the Validate method with some validation logic on my model...
I saw some other interface called Iclientvalidatable for calling validation methods from jquery validation(client side)..
Now I am trying to call the Validate method from client side...Is it possible??
Do I need to implement Iclientvalidatable interface on same model and needs to write the same logic in this method also??
Or Can I directly access the validate method from IClietnValidatable method??
My goal is accessing the validate method logic from client side..If its not possible to do..then i need to write same logic on client side also...
Please help me..thanks..
Upvotes: 1
Views: 2225
Reputation: 3258
You cannot link class level validators to client side validation.
See IValidatableObject in MVC3 - client side validation
Upvotes: 1
Reputation: 1038730
If you want custom client side validation you need to implement the IClientValidatable
interface but the actual validation logic should be done using javascript. And here's another example.
Upvotes: 1