Extension method extends an existing class. In this post, we will add an extension method to HtmlHelper
class. The method display error messages.
Validation
Data annotations validates user input. An example is shown below.
[Required(ErrorMessage = "Please enter name")] public string Name { get; set; }
Controller has the ModelState
object. ModelState
object has the validation errors. For each user input (eg.…