0

I'm having problems to include a css class in a Html.ActionLink. Actually, I search and found a code like this:

@Html.ActionLink("View Performances", "Details", "Productions", 
    new { name = item.show , year = item.year }, 
    new {@class = "button"}

But the problem is it is not working. May be because I already include the css in and

  • blocks? My code is like this:
    <ul id="menuTop">
        <li id="menu-link-1">@Html.ActionLink("Home", "Index", null, null, new { @class = "link-1-visited" })</li>
        <li id="menu-link-2">@Html.ActionLink("Produtos", "Products", null, null, new { @class = "link-2-visited" })</li>
        <li id="menu-link-3">@Html.ActionLink("Fale Conosco", "ContactUs", null, null, new { @class = "link-3-visited" })</li>
        <li id="menu-link-4">@Html.ActionLink("Quem Somos", "AboutUs", null, null, new { @class = "link-4-visited" })</li>
    </ul>
    

    I want the button get the css class when it is clicked. Do you have any idea?

    Thanks for any sugestions.

  • Lucas Borsatto
    • 183
    • 1
    • 10

    1 Answers1

    1

    You would need to set a css such as:

    .link-1-visited:visited { color:#a00; }
    

    Should set the link once clicked to red.

    LUKE
    • 1,375
    • 11
    • 9
    • But the problem is I want to change the focus, unterstood? When I click in one of them, I want the button clicked before turn to normal again. – Lucas Borsatto Jul 16 '13 at 00:35
    • http://stackoverflow.com/questions/4099621/asp-net-mvc-navigation-and-highlighting-the-current-link – LUKE Jul 16 '13 at 02:01