Built-in Tag Helpers

Tag Helpers are a new feature that have been introduced with ASP.NET MVC Core; their purpose is similar to those of HTML Helpers, but they provide an alternative syntax to the traditional HTML Helpers. Currently, ASP.NET MVC Core provides a range of built-in Tag Helpers; for example, consider the following HTML for a textbox with an ID and a name attribute of CustomerName:

<input type="text" name="CustomerName" id="CustomerName" class="form-control"> 

To generate the preceding HTML markup using a Tag Helper and data passed in to the view via a model, you would use the following:

<input asp-for="CustomerName" class="form-control" /> 

As you can see, Tag Helpers provide a cleaner syntax and will also make it easier for designers ...

Get Bootstrap for ASP.NET MVC - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.