[英]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.