我試圖創建一個ActionLink從網格導出數據。網格由查詢字符串中的值過濾。下面是URL的一個例子:添加查詢字符串作爲路由值字典到ActionLink
http://www.mysite.com/GridPage?Column=Name&Direction=Ascending&searchName=text
下面就以我的ActionLink添加到頁面代碼:
@Html.ActionLink("Export to Excel", // link text
"Export", // action name
"GridPage", // controller name
Request.QueryString.ToRouteDic(), // route values
new { @class = "export"}) // html attributes
當顯示的鏈接,網址是:
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
我究竟做錯了什麼?
您嘗試不工作的原因是.ToString()在Dictionary類中沒有重載(並且它不應該是,因爲它用於存儲更多不僅僅是路由字典參數)。 –
2011-05-29 03:40:37