Populating dropdown with JSON result - Cascading DropDown using MVC3, JQuery, Ajax, JSON

后端 未结 8 1790
长发绾君心
长发绾君心 2020-12-03 11:10

I\'ve got a cascading drop-drown using mvc. Something like, if you select a country in the first-dropdown, the states of that country in the second one should be populated a

8条回答
  •  广开言路
    2020-12-03 11:59

    Try this:

    public JsonResult getdist(int stateid)
    {
        var res = objdal.getddl(7, stateid).Select(m => new SelectListItem { Text = m.Name, Value = m.Id.ToString() });
        return Json(res,JsonRequestBehavior.AllowGet);
    }
    

提交回复
热议问题