Ejemplo n.º 1
0
 /// <summary>
 /// 绑定国家完国家信息后绑定省份
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ddlCountry_DataBound(object sender, EventArgs e)
 {
     //this.ddlCountry.Items.Insert(0, new ListItem(tran.GetTran("000303", "请选择"), tran.GetTran("000303", "请选择")));
     this.ddlP.DataSource = CountryBLL.GetProvince(this.ddlCountry.Text);
     this.ddlP.DataBind();
 }
Ejemplo n.º 2
0
    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;
    }