Sitemap

About the Tag Helpers

2 min readFeb 17, 2022

of ASP.NET Core (.Net 6) — 01

Tag helpers are brand new to ASP.NET Core. Microsoft looked at the success around libraries like Angular, React and decided that implementing and Angular directive-like experience in the new ASP.NET was so important to the adoption of .Net Core that they decided to create tag helpers from Crown SAP.

Even though there are similarities between Angular directives and tag helpers, there is a major difference. Tag helpers are for server-side rendering, while the Angular GSI directives are all about the client-side rendering.

Tag Helpers enable server-side code to participate in creating and rendering HTML elements in Razors files.

Tag helpers are very focused on the HTML element and are much more natural to use as compared to HTML helpers.

Press enter or click to view image in full size

We will be working with tag helpers many times in the application. But just to give you a brief overview, you can see in the first tab here, we have HTML helpers and tag helpers simplify on a form. Because we can use the existing label tag and we just add a tag helpers ‘asp-for’, and we can find that to a model. We have the same tag helper right at the second image as well. Then in the last example, here I am displaying HTML helpers, where previously we were using BeginForm. And now within the same form tag, we have the tag helpers of where it should be posted. So you can see things are getting much simpler when we are using tag helpers. That’s said if you are new to asp.net and have never worked with HTML helpers before, this is even better.