<form action="@Url.Action("PokemonSteps", "PokemonView", new { id = Model.Id, steps = steps })">
<input type="number" name="steps" min="1" max="@Model.userSteps">
<input type="submit">
</form>
此表单是从1到用户拥有的步数的数字框。 当他们在框中提交数字时,我想将它传递给@Url.Action
,作为steps = steps
部分中的steps
。MVC ASP.NET Url.Action在表单动作中将它传递给表单数据
我如何去说(对不起,真正愚蠢的问题)
不清楚是什么你问。你不应该有'new steps = steps' - 你有一个名为'steps'的表单控件,当你提交表单 –