Ajax.BeginForm replaces whole page onchange of a dropdownlist

前端 未结 2 415
误落风尘
误落风尘 2020-12-24 08:13

The purpose

I have a simple table listing names (in a partial view), and above it a dropdownlist containing those names. The purpose is to filter th

2条回答
  •  轮回少年
    2020-12-24 08:59

    In your dropdown replace:

    new { onchange = "this.form.submit()" }
    

    with:

    new { onchange = "$(this.form).submit();" }
    

    Also get rid of all MicrosoftAjax*.js scripts. Those are completely legacy and shouldn't be used in ASP.NET MVC 3 and newer applications. They are provided only for compatibility reasons if you are migrating from older versions. jQuery.js and jquery.unobtrusive-ajax.js are enough.

提交回复
热议问题