开发者

MVC3 - specifying htmlAttributes parameter to Html.ActionLink causes routevalues to be rendered incorrectly

开发者 https://www.devze.com 2023-03-31 04:45 出处:网络
I have this snippet of code in a Html helper extension routeValues[\"Page\"] = info.PageIndex - 1; builder.Append(\"<li>\")

I have this snippet of code in a Html helper extension

   routeValues["Page"] = info.PageIndex - 1;
                builder.Append("<li>")
                    .Append(LinkExtensions.ActionLink(html, "<<", actionName, routeValues, new { @class = "pageMore" }))
          开发者_Go百科          .Append("</li>");

he overloaded version of the ActionLink method I wish to use is this:

public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper,
string linkText, string actionName, object routeValues, object htmlAttributes);

The output of the link, however is:

http://localhost/Admin/Group/Details/61?Count=2&Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection[System.String%2CSystem.Object]&Values=System.Collections.Generic.Dictionary%602%2BValueCollection[System.String%2CSystem.Object]

Somehow when I specify the htmlAttributes, the routevalues are serialized.

What should I do to get the right output?

0

精彩评论

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