ModelState gives nice way to collect errors for reporting back to user. ModelState is basically a dictionary.
MVC provides Html extension, named ValidatioonMessage, that return a formated message based on the controller name.
Sample:
//save error
ModelState.AddModelError("Phone", attemptVal, "Dude it is wrong phone")
//placing msg on the page
<span><%Html.ValidationMessage("Phone")%></span>
Here is nice article ASP.NET MVC UI Error Handling - ModelState and AddModelError from David Hyden
MVC provides Html extension, named ValidatioonMessage, that return a formated message based on the controller name.
Sample:
//save error
ModelState.AddModelError("Phone", attemptVal, "Dude it is wrong phone")
//placing msg on the page
<span><%Html.ValidationMessage("Phone")%></span>
Here is nice article ASP.NET MVC UI Error Handling - ModelState and AddModelError from David Hyden