![](/img/trans.png)
[英]C# ActionLink MVC4 - Pass multiple parameters to ActionResult
[英]MVC C# ActionLink with multiple “news”
如何纠正此问题,以便ActionLink还原为http://localsite/forum/index/4
(其中4由parent_id定义,如下所示):
@Html.ActionLink("Cancel", "Index", "Forum", new { @class = "btn"}, new{ @id=ViewBag.parent_id })
目前它恢复为:
http://localhost:53731/Forum?class=btn
谢谢你的帮助,
标记
只需反转最后两个参数:
@Html.ActionLink("Cancel", "Index", "Forum", new{ @id=ViewBag.parent_id }, new { @class = "btn"})
routeValues应该在htmlAttributes之前
参见msdn
看来您已经颠倒了论点。
@Html.ActionLink("Cancel", "Index", "Forum", new{@id=ViewBag.parent_id }, new { @class = "btn"})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.