add a class attribute to an actionlink that has a routevaluedictionary
Im using an action l开发者_如何学运维ink and passing in tRVD where tRVD is the following:
<% RouteValueDictionary tRVD = new RouteValueDictionary(ViewContext.RouteData.Values); %>
heres my link.
<%= Html.ActionLink("Previous", "Index", tRVD)%>
how do i add a class attribute to this href?
i tried this:
<%= Html.ActionLink("Previous", "Index", tRVD, new { @class = "left" })%>
but it breaks the tRVD...
You´re using an incorrect overload of the ActionLink method. Why don´t you try with
<%= Html.ActionLink("Previous", "Index", tRVD, new Dictionary<string, object> { { "class", "left" } })%>
Regards.
精彩评论