Wednesday, March 5, 2014

How to get validation errors in ASP.NET MVC model?

foreach (ModelState state in ViewData.ModelState.Values) {
    foreach (ModelError error in state.Errors) {
        var ex = error;
    }
}

No comments:

Post a Comment