Using Data Annotations For Model Validation
Using Data Annotations For Model Validation
We can easily add validation to our application by adding Data Annotations to our
model classes. Data Annotations allow us to describe the rules we want applied to
our model properties, and ASP.NET MVC will take care of enforcing them and
displaying appropriate messages to our users.
Adding Validation to any Application
Some of Data Annotation attributes:
Note: For more information on Model Validation using Data Annotation attributes, see
the MSDN documentation at https://go.microsoft.com/fwlink/?LinkId=159063