Peter H
Peter H

Reputation: 901

MVC @html.Actionlink include html i tag

I currently have the following MVC code.

<li>@Html.ActionLink("Home", "Index", "Home")</li>

This generates the following HTML code

<li>
    <a href="/"></a>
</li>

How Can I obtain the following HTML code?

<a href="#">
    <i class="icon-home icon-white"></i>
     Home
</a>

Upvotes: 4

Views: 11197

Answers (1)

Peter H
Peter H

Reputation: 901

The Solution is to use the Url.Action Method.

<li>
    <a href="@Url.Action("Index", "Home")">
        <i class="glyphicon glyphicon-home"></i> Home
    </a>
</li>

Hopefully it helps others.

Upvotes: 11

Related Questions