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 to understand the page markup without having to know any Razor syntax.

Tip

You can learn more about Tag Helpers at http://bit.ly/TagHelpers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.237.136