The label Tag Helper generates the appropriate
The Input Tag Helper generates the appropriate <input> HTML element for the model property. The model property is bound using the asp-for attribute. The input tag helper generates the appropriate HTML type, name & id attribute based on the Property data type & data annotations applied to the ViewModel. The ViewModel must be strongly typed to the View. It also emits the Validation related attributes, which helps in unobtrusive client-side validation. The asp-format attributes help in generating the properly formatted input elements.
The environment tag helper supports rendering different content depending on the asp.net core environment variables set. In this tutorial, we will look at this Tag Helper in more detail
Tag Helpers are new features in ASP.NET Core, which help us add the server side code easily into our HTML markup. In this tutorial, we will make use of the tag helpers to update the HTML form, which we created in the previous tutorial.
In the previous tutorial, we saw how to build a simple HTML form. We made use of the ViewModel, but did not pass the instance of it to the view. The ViewModel can be passed from the controller to the view either using Viewbag or Viewdata. The ASP.NET Core provides the ability to pass strongly typed models or objects to a view. This approach helps us with the intellisense and better compile-time checking of our code. The scaffolding mechanism in Visual Studio can be used to create the View. Let us learn all these in the article.