2013-02-27 17 views
0

在電流控制器查看/用戶Html.ActionLink到了位於控制器

grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.UserId }), style: "column-action"), 

我有一個像查看另一個視圖/收預訂費

所以我想在網格中添加Html.ActionLink到了位於控制器

grid.Column(format: (item) => Html.ActionLink("Comission", "Index", "Comission", new { id = item.UserId }), style: "column-action") 

但我看到錯誤的URL像

http://localhost:51381/Users?Length=16 

,而不是它應該像

http://localhost:51381/Comission/Index/123-sfsdf-2342342-ssdfsdf 

任何線索如何解決呢?

+1

基本上,你正在使用Html.ActionLink的錯誤重載:http://stackoverflow.com/questions/2686260/asp-net-mvc-adding-querystring-length-to-actionlinks – 2013-02-27 22:07:17

+0

@QuetiMporta酷!把它像一個答案,請。 – 2013-02-27 22:13:22

回答

3

的問題是,您要創建的鏈接的方法是使用的不正確的過載Html.ActionLink。

您將需要添加null

看看這個other question看問題。

2

您需要添加null作爲最後一個參數(代表htmlArguments)使用正確的Html.ActionLink過載:

grid.Column(format: (item) => Html.ActionLink("Comission", "Index", "Comission", new { id = item.UserId }, /*here ->*/null), style: "column-action") 
相關問題