ASP.Net MVC,查看@class
问题描述:
我希望把我真棒在侧面导航栏链接旁边的字体,我已经加入这个的_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某处包括标签,但不知道如何
答
您所使用的过载是不正确 - 你需要使用
<li>@Html.ActionLink("Mechanic Ranking", "Rankings", "Report", null, new { @class = "fa fa-area-chart" })</li>
MSDN Documentation here。
您看到length = 6的原因是该类被解释为路由值而不是HTML属性,因为它被传递到routevalues参数的位置而不是htmlattributes参数。
答
你可以尝试以下方法:为帮助伙计
<a href="@Url.Action("Rankings", "Report")"><i class="fa fa-area-chart"></i> Mechanic Ranking</a>
啊我现在看到的,谢谢:-) – Johnn5er 2015-02-24 20:54:46