Tuesday, December 30, 2014

Validation Groups for ASP.NET MVC

If you are used to working with ASP.NET Web Forms, you are probably already familiar with Validation Groups which allow you to validate a portion of a form at a single time rather than validating the entire form.  Validation Groups were introduced with ASP.NET 2.0.

However, even if you are using the latest version of ASP.NET MVC (v. 5.0 as of this writing), you will notice that this functionality is notably missing.

Of course, some projects have arisen recognizing the need to fill this gap in ASP.NET MVC such as the Validation Groups project on CodePlex:  https://mvc3validationgroups.codeplex.com/.  There is even a NuGet package available for this project here: https://www.nuget.org/packages/Mvc3ValidationGroups/

Unfortunately, as you can tell, this code is very much outdated since it only references MVC3 and it does not seem to have been updated in several years. 

While this library does not provide the same functionality as Validation Groups, it provides a good way to consolidate validation logic for your MVC Models/ViewModels: http://fluentvalidation.codeplex.com/

This project is up-to-date with support for ASP.NET MVC 5 so you can use it in your latest MVC projects.

Finally, if you want Microsoft to include Validation Group support in the next release of ASP.NET MVC (MVC 6), I would encourage you to vote for this User Voice item here: http://aspnet.uservoice.com/forums/41201-asp-net-mvc/suggestions/2071605-validation-group-support


  1. Iam really satisfy by your information. It's well-written, to the point, and relative to what I do. I like it very much for giving information on. I hope you can continue and post more.
    Microsoft Dynamics CRM Training | VMware Virtualization Online Training

  2. This comment has been removed by the author.