protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { DropDownList2.Items.Clear (); city_keeper ck = new city_keeper(); ArrayList arr = ck.populate_city(DropDownList1.SelectedItem.ToString()); foreach (object o in arr) { if (o.GetType() == typeof(string)) { string st = (string)o; DropDownList2.Items.Add(st); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { city_keeper ck = new city_keeper(); ArrayList arr = ck.populate_state(); foreach (object o in arr) { if (o.GetType() == typeof(string)) { string st = (string)o; DropDownList1.Items.Add(st); } } } }