O'Reilly logo

ASP.NET MVC 1.0 Quickly by Maarten Balliauw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating data

One of the common requirements when creating an application is to validate data and inform the user if something goes wrong. ASP.NET Webforms offered validation controls and an optional validation summary. When invalid values were entered in a specific control, an error message was displayed. The validation summary would show all of the generated error messages.

The ASP.NET MVC framework offers the same possibilities but in a different manner. The HtmlHelper class provides two methods: ValidationMessage and ValidationSummary. The first one will display a message for a specific control, while the latter will render a complete summary of all generated validation errors.

The examples in this topic are based on an ASP.NET MVC web application, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required