0

How do I correct this so that the ActionLink reverts to http://localsite/forum/index/4 (where 4 is defined by the parent_id as shown below):

 @Html.ActionLink("Cancel", "Index", "Forum", new { @class = "btn"}, new{ @id=ViewBag.parent_id })

Currently it reverts to:

http://localhost:53731/Forum?class=btn

Thanks for your help,

Mark

4

2 に答える 2

3

最後の2つのパラメータを反転するだけです。

@Html.ActionLink("Cancel", "Index", "Forum",  new{ @id=ViewBag.parent_id }, new { @class = "btn"})

routeValuesはhtmlAttributesの前に来る必要があります

msdnを参照してください

于 2013-03-06T15:56:26.347 に答える
2

引数が逆になっているようです。

 @Html.ActionLink("Cancel", "Index", "Forum", new{@id=ViewBag.parent_id }, new { @class = "btn"})
于 2013-03-06T15:57:26.253 に答える