A lot of our UI frameworks in .NET also provide support for
DataAnnotation-based validation rules. For example, ASP.NET MVC, ASP.NET
Dynamic Data, and Silverlight (via WCF RIA Services) all provide support for
displaying client-side validation UI that honor the DataAnnotation rules
applied to model objects.
The screen-shot below demonstrates how using the default
“Add-View” scaffold template within an ASP.NET MVC 3 application will cause
appropriate validation error messages to be displayed if appropriate values are
not provided:
ASP.NET MVC 3 supports both client-side and server-side
enforcement of these validation rules. The error messages displayed are
automatically picked up from the declarative validation attributes –
eliminating the need for you to write any custom code to display them.