DamianEdwards / TagHelperStarterWeb

ASP.NET 5 Starter Web project template converted to use Tag Helpers
Apache License 2.0
80 stars 24 forks source link

Where are the differences? #1

Closed robertmclaws closed 9 years ago

robertmclaws commented 9 years ago

I'm having trouble seeing the differences between this and the regular project. Is the main difference with the Form tag? I thought maybe you had made some custom taghelpers for this project or something...

Thanks!

yishaigalatzer commented 9 years ago

It's showing what the template looks like with the built in tag helpers

joeriks commented 9 years ago

The new syntax:

<a controller="Home" action="Index" class="navbar-brand">Application name</a>

Old syntax:

@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })              

And

<form controller="Account" action="Login" route-returnurl="@ViewBag.ReturnUrl" method="post" class="form-horizontal" role="form">                  
    <h4>Use a local account to log in.</h4>
    <hr />
    <div validation-summary="ModelOnly" class="text-danger"></div>
    <div class="form-group">
        <label for="UserName" class="col-md-2 control-label"></label>
        <div class="col-md-10">
            <input for="UserName" class="form-control" />
            <span validation-for="UserName" class="text-danger"></span>
        </div>
    </div>

Instead of

@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    <h4>Use a local account to log in.</h4>
    <hr />

    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
            @Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" })
        </div>
    </div>

Looks so much better! Looking forward to use this technique also for custom helpers.

And I'm hoping for first class IDE help at some point - Intellisense and refactoring help would be real killer features for this :)