相关疑难解决方法(0)

将查询字符串作为路径值字典添加到ActionLink

我正在尝试创建一个ActionLink来从网格中导出数据.网格由查询字符串中的值过滤.这是url的一个例子:

http://www.mysite.com/GridPage?Column=Name&Direction=Ascending&searchName=text
Run Code Online (Sandbox Code Playgroud)

这是将ActionLink添加到页面的代码:

@Html.ActionLink("Export to Excel",    // link text
    "Export",                          // action name
    "GridPage",                        // controller name
    Request.QueryString.ToRouteDic(),  // route values
    new { @class = "export"})          // html attributes
Run Code Online (Sandbox Code Playgroud)

显示链接时,网址为:

http://www.mysite.com/GridPage/Export?Count=3&Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

c# asp.net asp.net-mvc

10
推荐指数
2
解决办法
3万
查看次数

标签 统计

asp.net ×1

asp.net-mvc ×1

c# ×1