Ejemplo n.º 1
0
        private void CbPro_SelectionChangeCommitted(object sender, EventArgs e)
        {
            ProCityCounty pro = (ProCityCounty)CbPro.SelectedItem;

            CbCounty.DataSource = null;

            CityDataBind(pro.Href);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 县市数据绑定
        /// </summary>
        /// <param name="href"></param>
        private void CountyDataBind(string href)
        {
            string url = ConfigurationSettings.AppSettings["city"] + href + ".html";

            List <ProCityCounty> countys = new List <ProCityCounty>();

            string[] data = WebClientExt.GetHtmlData(url).Replace("||", "|").Split('|');
            foreach (var d in data)
            {
                ProCityCounty county = new ProCityCounty();
                county.Name = Regex.Replace(d, @"[^\u4e00-\u9fa5]", "").ToString();
                county.Href = Regex.Replace(d, @"\D", "").ToString();
                countys.Add(county);
            }
            CbCounty.DataSource    = countys;
            CbCounty.DisplayMember = "Name";
            CbCounty.ValueMember   = "Href";
        }
Ejemplo n.º 3
0
        private void CbCity_SelectionChangeCommitted(object sender, EventArgs e)
        {
            ProCityCounty city = (ProCityCounty)CbCity.SelectedItem;

            CountyDataBind(city.Href);
        }