O'Reilly logo
  • Ryan Garrett thinks this is interesting:

I check to see if there has been a validation problem using the ModelState.IsValid property in the controller class. Listing 2-17 shows how I have done this in the POST-enabled RsvpForm action method in the Home controller class.


Cover of Pro ASP.NET MVC 5, Fifth Edition


How to check for Model validation errors. Remember that by using the Html helpers, typed models for views and data annotations, a lot of the validation logic is given for free.