protected void DropDownListSelectState_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownListSelectState.SelectedIndex == 0) { DropDownListSelectCity.SelectedIndex = 0; DropDownListSelectCity.Enabled = false; } else { MultiView1.ActiveViewIndex = 1; DropDownListSelectCity.Enabled = true; StatesCities GetCitiesByState = new StatesCities(); DropDownListSelectCity.DataSource = GetCitiesByState.Get_CitiesByStateId(Convert.ToInt32(DropDownListSelectState.SelectedValue)); DropDownListSelectCity.DataTextField = "CityName"; DropDownListSelectCity.DataValueField = "CityID"; DropDownListSelectCity.DataBind(); ListItem listates = new ListItem(); DropDownListSelectCity.Items.Insert(0, listates); } }
protected void States() { StatesCities GetStates = new StatesCities(); DropDownListSelectState.DataSource = GetStates.Get_States(); DropDownListSelectState.DataTextField = "StateName"; DropDownListSelectState.DataValueField = "StateID"; DropDownListSelectState.DataBind(); ListItem listates = new ListItem(); DropDownListSelectState.Items.Insert(0, listates); DropDownListSelectCity.Enabled = false; DropDownListSlctStatePnl3.DataSource = GetStates.Get_States(); DropDownListSlctStatePnl3.DataTextField = "StateName"; DropDownListSlctStatePnl3.DataValueField = "StateID"; DropDownListSlctStatePnl3.DataBind(); ListItem listStates = new ListItem(); DropDownListSlctStatePnl3.Items.Insert(0, listStates); }