void LoadProvince() { cbProvince.Items.Clear(); cbProvince.Items.Add(new ListItem("请选择", "")); List <CBaseObject> lstObj = Global.GetCtx().ProvinceMgr.GetList(); foreach (CBaseObject obj in lstObj) { CProvince province = (CProvince)obj; ListItem item = new ListItem(province.Name, province.Id.ToString()); cbProvince.Items.Add(item); } cbProvince.SelectedIndex = 0; }
void LoadCity() { cbCity.Items.Clear(); cbCity.Items.Add(new ListItem("请选择", "")); if (cbProvince.SelectedIndex == 0) { return; } CProvince province = (CProvince)Global.GetCtx().ProvinceMgr.Find(new Guid(cbProvince.SelectedItem.Value)); List <CBaseObject> lstObj = province.CityMgr.GetList(); foreach (CBaseObject obj in lstObj) { CCity city = (CCity)obj; ListItem item = new ListItem(city.Name, city.Id.ToString()); cbCity.Items.Add(item); } cbCity.SelectedIndex = 0; }