asp.net mvc calling dropdown ajax request

前端 未结 1 1883
遥遥无期
遥遥无期 2021-01-15 04:32

ok i have a record grid with different records

plus i have a dropdown as column as well (which ought to go and just save the value i have selected and come back on

相关标签:
1条回答
  • 2021-01-15 05:14

    I would use jquery to bind to the dropdown's change event, and then post the value to your controller action. You can assign a class to the dropdown to make it easy to select with jquery.

    <%= Html.DropDownList("SelectedItem", JobHelper.GetSelectStatus(item.int_JobFormMain) as IEnumerable<SelectListItem>, new { @class = "SelectedItemDropDown" })%>
    
    <script type="text/javascript">
        $(document).ready(function()
        {
            $(".SelectedItemDropDown").change(function()
            {
                $.post("controller/SaveStatus", { id : $(this).val() });
            }
        }
    </script>
    
    0 讨论(0)
提交回复
热议问题