Thursday, 3 May 2012

Client Side Validation in mvc

There ate two types validation in mvc :Client side and Server side.Client side is more faster than server side validation.Its detect the error when we pressed tab button.Also its wont load the page until solve the validation error.Lets see the ex:





Add the Above three Line in view page.just we need to enable client validation in this page.it will take care of remaining things.Also we need to write some code in model.
In Model:







                    

Just add the two componentModel and DataAnnotations in header. In the above property declare which type validation you required.
The Output is:

No comments:

Post a Comment