How do I get the collection of errors in a view?
I don\'t want to use the Html Helper Validation Summary or Validation Message. Instead I want to check for errors an
Putting together several answers from above, this is what I ended up using:
var validationErrors = ModelState.Values.Where(E => E.Errors.Count > 0)
.SelectMany(E => E.Errors)
.Select(E => E.ErrorMessage)
.ToList();
validationErrors
ends up being a List
that contains each error message. From there, it's easy to do what you want with that list.