How do I apply a CSS class to Html.ActionLink in ASP.NET MVC?
In C# it also works with a null as the 4th parameter.
@Html.ActionLink( "Front Page", "Index", "Home", null, new { @class = "MenuButtons" })
This syntax worked for me in MVC 3 with Razor:
@Html.ActionLink("Delete", "DeleteList", "List", new { ID = item.ID, ListID = item.id }, new {@class= "delete"})
@ewomack has a great answer for C#, unless you don't need extra object values. In my case, I ended up using something similar to:
@Html.ActionLink("Delete", "DeleteList", "List", new object { },
new { @class = "delete"})
It is:
<%=Html.ActionLink("Home", "Index", MyRouteValObj, new with {.class = "tab" })%>
In VB.net you set an anonymous type using
new with {.class = "tab" }
and, as other point out, your third parameter should be an object (could be an anonymous type, also).