标签:
1 private void cmbXPROVINCE_SelectedIndexChanged(object sender, EventArgs e) 2 { 3 DataBind(cmbXPROVINCE, cmbXROAD); 4 } 5 6 /// <summary> 7 /// 实现省、市 8 /// </summary> 9 /// <param name="cmbFirst">一级(区市)</param> 10 /// <param name="cmbSecond">二级(街道)</param> 11 public void DataBind(ComboBoxEdit cmbFirst, ComboBoxEdit cmbSecond) 12 { 13 switch (cmbFirst.Text.Trim()) 14 { 15 case "河南省": 16 cmbSecond.Properties.Items.Clear(); 17 cmbSecond.Text = ""; 18 cmbSecond.Properties.Items.Add("郑州市"); 19 cmbSecond.Properties.Items.Add("开封市"); 20 cmbSecond.Properties.Items.Add("驻马店市"); 21 cmbSecond.Properties.Items.Add("安阳市"); 22 cmbSecond.Properties.Items.Add("洛阳市"); 23 cmbSecond.Properties.Items.Add("周口市"); 24 25 break; 26 27 case "河北省": 28 cmbSecond.Properties.Items.Clear(); 29 cmbSecond.Text = ""; 30 cmbSecond.Properties.Items.Add("保定"); 31 cmbSecond.Properties.Items.Add("石家庄"); 32 cmbSecond.Properties.Items.Add("邯郸"); 33 break; 34 //.......... 35 36 default: 37 break; 38 } 39 }
标签:
原文地址:http://www.cnblogs.com/mengzhixingping/p/4650956.html