开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜