Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Created August 22, 2013 10:24
Show Gist options
  • Save csharpforevermore/6305613 to your computer and use it in GitHub Desktop.
Save csharpforevermore/6305613 to your computer and use it in GitHub Desktop.
When your Action has the condition "ModelState.IsValid = false", you sometimes need to know what is failing. In this case, use the following to iterate through your MVC errors.
foreach (ModelState state in ViewData.ModelState.Values.Where(x => x.Errors.Count > 0))
{
var setbreakpointhere = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment