Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

What is the advantage of using Tag Helpers in ASP.Net MVC 5

$
0
0
apologized that i am not very good in asp.net mvc that i would like to confess. i just come across a good write up for asp.net 5 new feature from this url http://stephenwalther.com/archive/2015/02/24/top-10-changes-in-asp-net-5-and-mvc-6
 
from there i heard about a term called Tag Helpers in ASP.Net MVC 5 and i saw there people say before developer create form this below way
 
@model MyProject.Models.Product
 
@using (Html.BeginForm())
{
    <div>
        @Html.LabelFor(m => p.Name, "Name:")
        @Html.TextBoxFor(m => p.Name)
    </div><inputtype="submit"value="Create"/>
}
 
and now people can code the same with tag helper the below way
 
@model MyProject.Models.Product
@addtaghelper "Microsoft.AspNet.Mvc.TagHelpers" 
<form asp-controller="Products" asp-action="Create" method="post">
    <div>
        <label asp-for="Name">Name:</label><inputasp-for="Name"/></div> 
    <inputtype="submit"value="Save"/></form>
 
they use some few new syntax called asp-controller,asp-for etc but what it will do.....how and why people would be benefited by using this new syntax asp-controller,asp-for etc.
 
so please some one help me to understand this new tag helper concept and how it will make a developer life easier. thanks
tbhattacharjee

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>