示例#1
0
        private void CbPro_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            ProCityCounty pro = (ProCityCounty)CbPro.SelectedItems;

            CbCounty.DataSource = null;

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

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

            string[] data = WebClientExt.GetHtmlData(url).Replace("||", "|").Split('|');
            foreach (var d in data)
            {
                ProCityCounty couty = new ProCityCounty();
                couty.Name = Regex.Replace(d, @"[^\u4e00-\u9fa5]", "").ToString();
                couty.Href = Regex.Replace(d, @"\D", "").ToString();
                coutys.Add(couty);
            }
            CbCounty.DataSource    = coutys;
            CbCounty.DisplayMember = "Name";
            CbCounty.ValueMember   = "Href";
        }
示例#3
0
        private void CbCity_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            ProCityCounty city = (ProCityCounty)CbCity.SelectedItems;

            CountyDataBind(city.Href);
        }