Home/MVC/Validation in MVC4 Razor with the Data Annotation Validators in “MODEL”

Validation in MVC4 Razor with the Data Annotation Validators in “MODEL”

Data Annotation

Data validation play major role when developing web application. In Asp.net MVC, we can easily implement validation to application by using Data Annotation attribute to model. Data Annotation attribute classes are present in System.ComponentModel. DataAnnotations namespace. It is a common validation attributes which extend the built-in ASP.NET DataAnnotations (Required, Range, RegularExpression, StringLength etc.,). ASP.NET MVC uses jquery unobtrusive validation to perform client side validation.




Validation using Data Annotation Validator 1 - MVC - dotnet-helpers

Below output shows the Email validation and Range validation

Validation using Data Annotation Validator 2 - MVC - dotnet-helpers


Validation for password comparsion



  1. bid ninja April 5, 2013 at 7:06 pm

    Pretty excellent post. I just stumbled upon your blog and wanted to say that I have very enjoyed reading your blog posts. Any way I’ll be subscribing for your feed and I hope you write-up again soon.

  2. mine bitcoins April 19, 2013 at 9:22 am

    This is Awesome! Thank you so much.

  3. Anonymous April 25, 2013 at 4:21 pm

    This site just made my week! I were seeking close to for info on this. I’m glad now that I ran across this webpage. Woohoo!

  4. Beatriz Rojas May 16, 2013 at 11:50 am

    WONDERFUL Post.thanks for share..extra wait .. …

  5. Anonymous July 10, 2013 at 4:54 pm

    thanks for sharing. awesome.

  6. Cialis Online October 4, 2013 at 10:29 am

    Thanks very interesting blog!

  7. Dhana October 24, 2013 at 11:07 am

    Great work, keep it up…

  8. thiyaguji October 24, 2013 at 12:13 pm

    Thanks Dhana

  9. thiyaguji October 26, 2013 at 4:31 pm

    Thanks for your comments. Soon I will come up with my next post.

  10. Avadhesh December 14, 2013 at 2:23 pm

    All the things are clear in one place. Thanks

  11. thiyaguji December 16, 2013 at 5:17 am

    Thanks Avadhesh

  12. WilliamJef February 7, 2016 at 3:20 pm

    nice site!

  13. Chris March 16, 2018 at 6:23 pm

    Thank you in 2018!

Leave a Reply