This question is locked. New answers and comments are not allowed.
Hi,
Sorry for my English.
I need dynamic dropdownlist. I have 2 dropdownlists, and i want that after choose data in first dropdown, second dropdown filling data with parameter from first dropdown.
I have View
and Controller
But it's not work. How I can do it?
Sorry for my English.
I need dynamic dropdownlist. I have 2 dropdownlists, and i want that after choose data in first dropdown, second dropdown filling data with parameter from first dropdown.
I have View
@(Html.Telerik().ComboBox() .Name("AjaxComboBox") .AutoFill(true) .DataBinding(binding => binding.Ajax().Select("_AjaxLoading", "Home")) .Filterable(filtering => { filtering.FilterMode(AutoCompleteFilterMode.StartsWith); }) .HighlightFirstMatch(true))@(Html.Telerik().DropDownList() .Name("AjaxDropDownList") .DataBinding(binding => binding.Ajax().Select("_AjaxLoading2", "Home", new { id = ViewData["AjaxComboBox"] })))and Controller
[HttpPost]public ActionResult _AjaxLoading(string text){ Thread.Sleep(1000); using (var nw = new InetShopDBEntities()) { var producttypes = nw.TypeOf.AsQueryable(); return new JsonResult { Data = new SelectList(producttypes.ToList(), "TypeOf_ID", "Name") }; }}[HttpPost]public ActionResult _AjaxLoading2(string text, int id){ Thread.Sleep(1000); using (var nw = new InetShopDBEntities()) { var products = nw.Product.AsQueryable(); products = products.Where(p => p.TypeOf == id); return new JsonResult { Data = new SelectList(products.ToList(), "Product_ID", "Name") }; }}But it's not work. How I can do it?