Before reading this article, I highly recommend reading the previous part of the series on ASP.NET:

HTML Helpers

HTML Helpers are used to create HTML markup to create HTML Controls. HTML Helper is just a method that returns an HTML string. There are three kinds of HTML Helpers:

  1. Inline HTML Helpers: These are created by the @helper tag of Razor Syntax. These Helpers can be reused only on the same view.

  2. Built-In HTML Helpers: These HTML Helpers are extension methods on the HtmlHelper class. These are categorized in to three parts:

    • Standard HTML Helpers: These helpers are used to create the most common types of HTML elements.

    • Strongly Typed HTML Helpers: The HTML is generated through Model Class Properties. These helpers work on lambda expression.

    • Templated HTML Helpers: These helpers defines what HTML elements are required to render based on properties of our Model class.

  3. Custom HTML Helpers: You can also create your own custom helper methods by creating an extension method on the HtmlHelper class or by creating static methods within a utility class.

Step 1: Open the Visual Studio and select the “File” menu, New, then Project.

Visual Studio

In the following figure select “Templates”, Visual C#, ASP.NET Web Application, and here I gave the name of project as “HTMLHelpersWithMVC.

Thanks for reading this article and stay connected with my articles.

Read more articles on ASP.NET MVC 5: