gpt4 book ai didi

asp.net-mvc-3 - 提交更改下拉列表的表单

转载 作者:行者123 更新时间:2023-12-04 06:29:44 25 4
gpt4 key购买 nike

我正在使用 MVC 3 和 razor,并且有一个表单,其中有一个下拉列表。当下拉列表中的值发生变化时,如何提交表单?我没有提交按钮。

@using (Html.BeginForm())
{
...

<div class="row">
<label>
Type of Card</label>
<div class="item">
@Html.DropDownList("PaymentFormModel.CardType", cardTypes, new { required = "required" })
</div>
</div>
...
}

最佳答案

像这样尝试

@Html.DropDownList("PaymentFormModel.CardType", cardTypes, new { required = "required", @onchange="submitform();" })

这是它的脚本:
function submitform()
{
$('form').submit();
}

希望能帮助到你

关于asp.net-mvc-3 - 提交更改下拉列表的表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14155672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com