ASP.NET MVC dropdown on change to trigger postback without Javascript

Is it possible to call back a link from an action of changing your choice in the drop-down list without using JavaScript?

I remember when using the ASP.NET Forms drop-down list of elements there was a property that, when set, causes a postback when changing, did it run without JS? “If so, how?”

Thanks a lot, Cohan.

+3
source share
4 answers

JavaScript . , . JavaScript (- ), .

, AutoPostBack.

+3

jQuery. JavaScript . ASP.NET JavaScript AutoPostBack.

<script type='text/javascript'\> 
  $('#dropDown').change(function () {
    $(this).parents('form').submit();
  });
</script>
+6
+1

script,

 @Html.DropDownList("Projects", Model.Projects, new { 
 style = "Height: 25px; width: 225px;", 
 onchange = "$(this).parents('form').submit();" })
+1

Source: https://habr.com/ru/post/1781680/


All Articles