Exemplo n.º 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);
        }
Exemplo n.º 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";
        }
Exemplo n.º 3
0
        private void CbCity_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            ProCityCounty city = (ProCityCounty)CbCity.SelectedItems;

            CountyDataBind(city.Href);
        }