Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MVC ModelError how to get value
- ModelState.AddModelError("duplicateInvoiceNumberOrganisation", "The combination of organisation and invoice number must be unique");
- controller.ModelState.Values
- Count = 1
- [0]: {System.Web.Mvc.ModelState}
- string error = ModelState["duplicateInvoiceNumberOrganisation"]
- .Errors[0]
- .ErrorMessage;
- string error = ModelState
- .Where(x => x.Value.Errors.Count > 0)
- .First()
- .Value
- .Errors[0]
- .ErrorMessage;
Add Comment
Please, Sign In to add comment