public void SelectCountry(string guojia, string shengfen, string city, string xian) { if (guojia == "") { guojia = "中国"; // GetTran("007804", "中国"); } TextCity.Text = city; TextGuojia.Text = guojia; TextShenFen.Text = shengfen; TextXian.Text = xian; this.ddlCity.Items.Clear(); this.ddlP.Items.Clear(); this.ddlCountry.Items.Clear(); this.ddlX.Items.Clear(); BindGuojia(guojia); check = true; //选中国家 //选中省份 this.ddlP.DataSource = CountryBLL.GetProvince(guojia); this.ddlP.DataBind(); ddlP.SelectedIndex = -1; ddlP.Items.Insert(0, tran.GetTran("000303", "请选择")); foreach (ListItem item1 in ddlP.Items) { if (item1.Value == shengfen) { item1.Selected = true; break; } } //选中省份 //选中城市 this.ddlCity.DataSource = CountryBLL.GetCitys(shengfen, guojia); this.ddlCity.DataBind(); ddlCity.SelectedIndex = -1; ddlCity.Items.Insert(0, tran.GetTran("000303", "请选择")); foreach (ListItem item2 in ddlCity.Items) { if (item2.Value == city) { item2.Selected = true; break; } } //选中城市 //选中县 this.ddlX.DataSource = CountryBLL.GetXians(city, shengfen, guojia); this.ddlX.DataBind(); ddlX.SelectedIndex = -1; ddlX.Items.Insert(0, tran.GetTran("000303", "请选择")); foreach (ListItem item3 in ddlX.Items) { if (item3.Value == xian) { item3.Selected = true; break; } } this.TextShenFen.Text = this.ddlP.SelectedValue; this.TextCity.Text = this.ddlCity.SelectedValue; this.TextXian.Text = this.ddlX.SelectedValue; }
/// <summary> /// 绑定城市信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlP_DataBound(object sender, EventArgs e) { //this.ddlP.Items.Insert(0, new ListItem(tran.GetTran("000303", "请选择"), tran.GetTran("000303", "请选择"))); this.ddlCity.DataSource = CountryBLL.GetCitys(this.ddlP.Text, this.ddlCountry.Text); this.ddlCity.DataBind(); }
/// <summary> /// 绑定城市信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlP_DataBound(object sender, EventArgs e) { this.ddlCity.DataSource = CountryBLL.GetCitys(this.ddlP.Text, this.ddlCountry.Text); this.ddlCity.DataBind(); }