MVC ASP.NET Url.Action 在表单操作中,向其传递表单数据

2023-12-26

        <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 as the steps in the steps = steps part.

我该怎么做(抱歉这个问题真的很愚蠢)


<form action="@Url.Action("PokemonSteps", "PokemonView")" method="post">
   <input type="hidden" name="id" value="@Model.Id">
   <input type="number" name="steps" min="1" max="@Model.userSteps">
   <input type="submit" value="Submit">
</form>

请添加属性方法=“帖子”并分享您的控制器方法签名...

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MVC ASP.NET Url.Action 在表单操作中,向其传递表单数据 的相关文章