Last active
June 8, 2016 20:12
-
-
Save caedmonjudd/76820e17d68637edae4d5afd0d5825db to your computer and use it in GitHub Desktop.
MVC3 Model Validatation - Extract Errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (ModelState modelState in ViewData.ModelState.Values) | |
{ | |
foreach (ModelError error in modelState.Errors) | |
{ | |
ModelState.AddModelError("Name", error.ErrorMessage); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment