How do you submit a dropdownlist in asp.net mvc from an Ajax form

前端 未结 7 1818
自闭症患者
自闭症患者 2020-12-25 13:12

How do you submit from a dropdownlist \"onchange\" event from inside of an ajax form?

According to the following question: How do you submit a dropdownlist in asp.ne

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-25 13:39

    If you are using MVC then probably the best way is with jQuery...

    <%= Html.DropDownList("sortByList", new SelectList(ViewData["SortOptions"]) %> 
    <%= Html.TextBox("updateText") %>
    
    
    

    Your controller would be something like:

    public JsonResult UpdateForm(string sortBy)
    {
        string result = "Your result here";
        return Json(result);
    }
    

提交回复
热议问题