Tutorial by Examples

<form asp-action="create" asp-controller="Home"> <!--Your form elements goes here--> </form>
<form asp-action="create" asp-controller="Home" asp-route-returnurl="dashboard" asp-route-from="google"> <!--Your form elements goes here--> </form> This will generate the below markup <form action=&qu...
Assuming your view is strongly typed to a view model like public class CreateProduct { public string Name { set; get; } } And you are passing an object of this to the view from your action method. @model CreateProduct <form asp-action="create" asp-controller="Home"...
Assuming your view is strongly typed to a view model like this public class CreateProduct { public IEnumerable<SelectListItem> Categories { set; get; } public int SelectedCategory { set; get; } } And in your GET action method, you are creating an object of this view model,...
You can create your own tag helpers by implementing ITagHelper or deriving from the convenience class TagHelper. The default convention is to target an html tag that matches the name of the helper without the optional TagHelper suffix. For example WidgetTagHelper will target a <widget> ta...
Label Tag Helper can be used to render label for a model property. It replaces method Html.LabelFor in previous versions of MVC. Let's say you have a model: public class FormViewModel { public string Name { get; set; } } In the view you can use label HTML element and asp-for tag helper: ...
Anchor tag helper is used generate href attributes to link to a particular controller action or MVC route. Basic example <a asp-controller="Products" asp-action="Index">Login</a> Sometimes, we need to specify additional parameters for the controller action that ...

Page 1 of 1