开发者

add a class attribute to an actionlink that has a routevaluedictionary

开发者 https://www.devze.com 2022-12-19 14:16 出处:网络
Im using an action l开发者_如何学运维ink and passing intRVD where tRVD is the following: <% RouteValueDictionarytRVD = new RouteValueDictionary(ViewContext.RouteData.Values); %>

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

精彩评论

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

关注公众号