2015-02-24 274 views
0

我希望把我真棒在側面導航欄鏈接旁邊的字體,我已經加入這個的_layout觀點:ASP.Net MVC,查看@class

<li>@Html.ActionLink("Bookings", "Index", "Booking", new { @class = "fa fa-table" })</li> 

它使得罰款,但導航變搞砸和崩潰:

http://localhost:54155/Length=6 

爲什麼它給我lenght = 6?

我瞧,我只是訪問到類,但是我相信我NEDD某處包括標籤,但不知道如何

回答

3

您所使用的過載是不正確 - 你需要使用

<li>@Html.ActionLink("Mechanic Ranking", "Rankings", "Report", null, new { @class = "fa fa-area-chart" })</li> 

MSDN Documentation here

您看到length = 6的原因是該類被解釋爲路由值而不是HTML屬性,因爲它被傳遞到routevalues參數的位置而不是htmlattributes參數。

+0

啊我現在看到的,謝謝:-) – Johnn5er 2015-02-24 20:54:46

1

你可以嘗試以下方法:爲幫助夥計

<a href="@Url.Action("Rankings", "Report")"><i class="fa fa-area-chart"></i> Mechanic Ranking</a>