protected void DropDown_state_SelectedIndexChanged(object sender, EventArgs e) { int id = int.Parse(DropDown_state.SelectedItem.Value); bs.sid = id; DropDown_city.DataSource = bs.bs_citybind(bs); DropDown_city.DataTextField = "City"; DropDown_city.DataValueField = "City"; DropDown_city.DataBind(); }
protected void DropDown_state_SelectedIndexChanged(object sender, EventArgs e) { int id = int.Parse(DropDown_state.SelectedItem.Value); SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "dd_city"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.AddWithValue("@id", id); SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); DropDown_city.DataSource = dt; DropDown_city.DataTextField = "CITY"; DropDown_city.DataValueField = "SID"; DropDown_city.DataBind(); }