private void GetAllCities1(string regId) { if (regId == null) regId = "31a173d8-4bba-df11-9a64-7071bc4b6942"; LocationAction objLocation = new LocationAction(); IEnumerable<SelectListItem> lstCityItem = objLocation.GetAllCitiesForRegion(regId).Select(c => new SelectListItem { Value = c.id.ToString(), Text = c.name }); ViewData["CityListItem"] = lstCityItem; }
public ActionResult Models1(string id) { string regId = id; LocationAction objLocation = new LocationAction(); IEnumerable<SelectListItem> lstCityItem = objLocation.GetAllCitiesForRegion(regId).Select(c => new SelectListItem { Value = c.id.ToString(), Text = c.name }); return Json(lstCityItem.ToList(), JsonRequestBehavior.AllowGet); }