0

在我拥有的当前控制器视图/用户中

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

我有另一种观点,例如Views/Commissions

所以我想在网格上添加Html.ActionLink到上定位的控制器

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

但我看到了错误的网址,例如

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

而不是应该像

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

任何线索如何解决它?

4

2 回答 2

3

问题是您创建链接的方法使用了不正确的 Html.ActionLink 重载。

您将需要添加null

看看this other question以了解问题。

于 2013-02-27T22:18:30.830 回答
2

您需要添加null作为最后一个参数(代表htmlArguments)以使用正确的Html.ActionLink重载:

grid.Column(format: (item) => Html.ActionLink("Comission", "Index", "Comission", new { id = item.UserId }, /*here ->*/null), style: "column-action") 
于 2013-02-27T22:10:01.077 回答