MVC – How to dynamically set @class in Html.ActionLink-Collection of common programming errors
Assuming you want “class” to be an HTML attribute and “PageIndex” to be an action parameter you can do this instead:
Pricing
MUSEFAN EDIT:
You can still use an ActionLink like this…
@Html.ActionLink("Pricing", "Index", "Pricing", new {PageIndex = 2}, new {@class = ViewBag.PageIndex == 2 ? "" : "ActiveMenuItem"})