ASP.NET MVC add css class to actionlink

Cameron picture Cameron · Apr 10, 2011 · Viewed 59.3k times · Source

How do I add a css class to this actionlink? I have read you do it something like new { class = button } but I'm not sure where to put it within my actionlink:

<%= Html.ActionLink("View Performances", "Details", "Productions", 
                    new { name = item.show , year = item.year }, null) %>

Answer

Bala R picture Bala R · Apr 10, 2011

you can try

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