ASP.NET MVC View Profile
I have an Html.Actionlink
to which I am trying to add a "class" and an ActiveClass.
<%= Html.ActionLink("Home", "Home", "Acco开发者_运维问答unt", null,
new {@class ="some-class"},
Html.RenderLinkClassIfActive("Home", "Account", "active")) %>
However, this doesn't work. What can I differently to make this work?
Could you add the RenderLinkClassIfActive
code please?
UPDATE: Supposing Html.RenderLinkClassIfActive("Home", "Account", "active")
returns a class if active try:
<%= Html.ActionLink("Home", "Home", "Account", null, new {@class ="some-class " + Html.RenderLinkClassIfActive("Home", "Account", "active") } )%>
精彩评论