我有一个Html.Actionlink
,我试图添加一个“类”和一个ActiveClass。
<%= Html.ActionLink("Home", "Home", "Account", null,
new {@class ="some-class"},
Html.RenderLinkClassIfActive("Home", "Account", "active")) %>
然而,这不起作用。我有什么不同才能使这项工作?
答案 0 :(得分:0)
您可以添加RenderLinkClassIfActive
代码吗?
更新:假设Html.RenderLinkClassIfActive("Home", "Account", "active")
返回一个类,如果有效,请尝试:
<%= Html.ActionLink("Home", "Home", "Account", null, new {@class ="some-class " + Html.RenderLinkClassIfActive("Home", "Account", "active") } )%>