Asp.net Core Tag Helpers for HTML Tags

Asp.net Core Tag Helpers for HTML Tags
Tag helpers are the classes that can be invoked as an html tag or html attribute.
They generate a html tag or adds values into attributes of existing html tags.
<input asp-for=”ModProp”>
<input type=”text” name=”ModProp” id=”ModProp” value=”ModValue” />
 
Tag Helpers for <a>, <form>
asp-controller
asp-action
asp-route-x
asp-route
asp-area
 
Tag Helpers for <input>, <textarea>, <label>
asp-for
 
Tag Helpers for <select>
asp-for
asp-items
 
Tag Helpers for <img>
asp-append-version
 
Tag Helpers for <span>
asp-validation-for
 
Tag Helpers for <script>
asp-fallback-src
asp-fallback-test
 
Tag Helpers for <div>
asp-validation-summary
Tag Helpers for <form>
<form asp-controller=”ControllerName” asp-action=”ActionName”>
</form>
will be converted as:
<form action=”~/ControllerName/ActionName”>
</form>
 
asp-controller and asp-action
Generates route url for the specified action method with “controller/action” route pattern.
 
 
Tag Helpers for <a>
<a asp-controller=”ControllerName” asp-action=”ActionName”> </a>
will be converted as:
<a href=”~/ControllerName/ActionName”> </a>
 
asp-controller and asp-action
Generates route url for the specified action method with “controller/action” route pattern.
 
 
Tag Helpers for <a> and <form>
<a asp-controller=”ControllerName” asp-action=”ActionName” asp-route-parameter=”value” > </a>
will be converted as:
<a href=”~/ControllerName/ActionName/value-of-parameter”> </a>
 
asp-route-x
Specifies value for a route parameter, which can be a part of the route url.
 
Tag Helpers for <input>, <textarea>, <select>
<input asp-for=”ModProp” />
will be converted as:
<input type=”text” name=”ModProp” id=”ModProp” value=”ModValue” data-val-rule=”ErrorMessage” />
 
asp-for
Generates “type”, “name”, “id”, “data-validation” attributes for the <input>, <textarea>, <select> tags.
 
 
Tag Helpers for <label>
<label asp-for=”ModProp”> </label>
will be converted as:
<label for=”ModProp”> </label>
 
asp-for
Generates “for” attribute for the <label>.
 
 

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply