MVC5 Actionlink:将数据作为查询字符串传递

时间:2014-04-07 14:09:14

标签: asp.net-mvc-4

以下是我的Html.Actionlink

@Html.ActionLink("Change Team", "Edit", "UserPlayers", new { MatchId = ViewBag.MatchId, UserId = ViewBag.UserId })

当我运行应用程序时,我得到了这个

http://localhost:50013/UserPlayers/Edit?Length=11

作为链接。

我不知道"长度= 11" 来自哪里。

1 个答案:

答案 0 :(得分:9)

您需要添加null作为最后一个参数:

@Html.ActionLink("Change Team", "Edit", "UserPlayers", new { MatchId = ViewBag.MatchId, UserId = ViewBag.UserId }, null)

如果没有这个,你使用Html.ActionLink()

的错误方法重载
相关问题