How to Validate Data Annotation Attributes in ASP.NET MVC

When the end user enters a data to your site, the form fields must be validated first before it is saved into the database. We often use Validation HTML helpers provided in ASP.NET MVC to perform input validations. You can also use data annotation attributes from System.ComponentModel.DataAnnotations namespace to perform validations at model level.

Data annotation attributes are sets of attributes that reside in System.ComponentModel.DataAnnotations namespace and allows you to validate the property values of a model class. When added, they can perform validations on the server as well on the client side.

This article will discuss the basics of using these attributes in your ASP.NET MVC application.

Read the rest of the post here: http://www.codeguru.com/csharp/.net/validating-data-using-data-annotation-attributes-in-asp.net-mvc.htm

Leave a Reply

Your email address will not be published. Required fields are marked *