Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 958
Peter H Avatar asked Jan 12 '23 03:01

Peter H


1 Answers

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.

like image 125
Peter H Avatar answered Jan 22 '23 17:01

Peter H