Reputation: 97
I want to put a font awesome beside my link in a side nav bar, i have added this to the _layout view:
<li>@Html.ActionLink("Bookings", "Index", "Booking", new { @class = "fa fa-table" })</li>
It renders fine but the navigation gets messed up and and crashes:
http://localhost:54155/Length=6
why is it giving me lenght=6 ?
I see i am only accessing to the class, but im sure i nedd to include the tag somewhere, but dont know how
Upvotes: 0
Views: 207
Reputation: 85
You can try the following:
<a href="@Url.Action("Rankings", "Report")"><i class="fa fa-area-chart"></i> Mechanic Ranking</a>
Upvotes: 1
Reputation: 2295
The overload you are using is incorrect - you need to use
<li>@Html.ActionLink("Mechanic Ranking", "Rankings", "Report", null, new { @class = "fa fa-area-chart" })</li>
MSDN Documentation here.
The reason you are seeing length=6 is that the class is being interpreted as a route value rather than an HTML attribute, due to it being passed in the position of the routevalues parameter rather than the htmlattributes parameter.
Upvotes: 3