How do you submit a dropdownlist in asp.net mvc

丶灬走出姿态 提交于 2019-11-30 06:34:29

try this:

<%=Html.DropDownList("TopItemsList", ViewData["ListData"], new { onchange="this.form.submit();" })%>

Every form element in the has a "form" property that is pointed to the form that contains this element.

Yes, using "Html." and "Ajax." has a difference. Ajax. means that partial page update will be used and the whole page will not be reloaded.

Lee Smith

Why are you mixing your html with javascript??

Delete the onchange attribute and add some JQuery:

$("#TopItemsList").change(function () {

    $("input[type=submit]").click();

});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!