How to add a span to an htmlhelper?

Asked

Viewed 44 times

2

I have this helper

 <li>@Html.ActionLink("Registar", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink"})</li>

I wanted to add this <span class="glyphicon glyphicon-user">

 <li><a href="#"><span class="glyphicon glyphicon-user"></span> Registar</a></li>
  • 2

    @Diegorafaelsouza funny in portugal is written Register

  • 1

    Diversity of the Portuguese language :)

1 answer

1


That answer of @David in the ONLY suggests using the Url.Action instead of the ActionLink.

Would look like this:

<li>
    <a href="@Url.Action("Register", "Account")">
        <span class="glyphicon glyphicon-user"/> Registrar
    </a>
</li>

I hope I’ve helped.

  • 1

    It worked like this '<li><a href="@Url.Action("Register","Account")"><span class="glyphicon glyphicon-user"/> Register</a></li>'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.