In ASP.MVC 3 or 4 (using Razor), how do you apply a CSS Class to a Url.Action() helper method? Is it possible?
Desired outcome:
<a href="home\index?page=2" class="FOO">BAR</a>
I have gotten this far:
@Url.Action("Index", "Home", new { page })
UPDATE: Thanks all. I made a couple of mistakes that I should clarify for future readers (most likely myself). I wish I could give more than one of you credit.
a) new { page } - do not do this. It will produce undesired output. I meant: ViewBag.page or ViewBag.pageNum
b) As a few of you pointed out, I needed Html.ActionLink() not Url.Action() which I had been using successfully until I switched to generating the full tag, not just the url.
I confirmed that the following works as desired:
@Html.ActionLink("BAR", "Index", "Home", new { ViewBag.PageNum }, new { @class = "FOO" })