I want to get all the error messages out of the modelState without knowing the key values. Looping through to grab all the error messages that the ModelState contains.

How can I do this?

20 s
20

Using LINQ:

IEnumerable<ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors);

Leave a Reply

Your email address will not be published. Required fields are marked *