public ActionResult District(int?ProvinceId) { landDistrictService _district = new landDistrictService(); SelectList select = new SelectList(_district.DanhSachDistrict(ProvinceId), "DistrictId", "Name", null); return(PartialView("District", select)); }
public ActionResult Index(int?id, int?state, string key) { ViewBag.id = id; ViewBag.state = state; ViewBag.AgentAddress = key; #region Dropdonwlist landProvinceService _province = new landProvinceService(); ViewBag.City = new SelectList(_province.DanhSachProvince(), "ProvinceId", "Name", id); landDistrictService _district = new landDistrictService(); List <landDistrict> ds = new List <landDistrict>(); if (id.HasValue) { ds = _district.FindList().Where(x => x.ProvinceId == id).ToList(); } ViewBag.Town = new SelectList(ds, "DistrictId", "Name", state); #endregion return(View()); }