问题描述
如果我在路径Teams / Search.cshtml的视图中,我想从这里转移到具有值玩家ID的玩家/编辑。所以我编写了如下代码:
@ Html.ActionLink(编辑,编辑,玩家,新{id = player.PlayerID})|
@ Html.ActionLink(编辑,编辑,新{id = player.PlayerID})|
@ Html.ActionLink(编辑,编辑,玩家)
这里我可以看到第一行是不正确。第二行是正确的,但它是团队/编辑的路径,第三行是玩家/编辑。
第三行是正确的路径但是我如何在这条路径中发送ID。
请帮我提前。
If I am in a view in path "Teams/Search.cshtml" , I want to shift from here to "Players/Edit" with the value player ID. So I wrote the code like:
@Html.ActionLink("Edit", "Edit","Players",new { id = player.PlayerID }) |
@Html.ActionLink("Edit", "Edit",new { id = player.PlayerID }) |
@Html.ActionLink("Edit", "Edit","Players")
Here I can see that first line is " NOT CORRECT ". Second Line is "Correct" but it goes the path"Teams/Edit" and third one goes to "Players/Edit" .
SO third one goes in correct path but how can I send the ID in this path.
Please help me to ahead.
这篇关于将ID从一个视图传递到另一个控制器的另一个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!