An extension method for HtmlHelper to display error messages

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.

Controller has the ModelState object. ModelState object has