public List <country> GetCountries() { assingmentEntities obj = new assingmentEntities(); List <country> countries = obj.countries.ToList(); return(countries); }
// GET: drop public ActionResult Index() { assingmentEntities obj = new assingmentEntities(); ViewBag.Countries = new SelectList(GetCountries(), "CountryID", "CountryName"); return(View()); }
public ActionResult GetStates(int CountryID) { assingmentEntities obj = new assingmentEntities(); List <state> states1 = obj.states.Where(x => x.countryid == CountryID).ToList(); ViewBag.abcd = new SelectList(states1, "stateid", "statename"); return(PartialView("DisplayStates")); }