ASP.NET MVC allows developers to create their own HTML helper methods either by creating static or extension methods. In essence, an HTML helper is simply a method that returns an HTML string.
HTML helpers enable you to use the same common block of markup on multiple pages and make the code and markup in your pages easier to read and maintain. This promotes the use of reusable code, and developers can also unit test their helper methods.
In this chapter, we will cover the following topics:
An overview of the built-in ASP.NET MVC HTML helpers
Creating helpers using the
@helper
syntaxCreating HTML helpers using static methods
Creating HTML helper extension methods
Creating fluent HTML helpers
Creating self-closing helpers