/// <summary> /// Summarise to bound the states when we select any country /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bcountry_SelectedIndexChanged(object sender, EventArgs e) { string x = bcountry.SelectedItem.Value.ToString(); ds = ds = countries.GetState(x); if (ds.Tables[0].Rows.Count > 0) { for (int i = 1; i <= ds.Tables[0].Rows.Count; i++) { bstate.Items.Add(""); bstate.Items[i].Text = ds.Tables[0].Rows[i - 1]["txtState"].ToString(); bstate.Items[i].Value = ds.Tables[0].Rows[i - 1]["intState_id"].ToString(); } } }
void bindstates(string country) { con.Open(); SqlCommand cmd = new SqlCommand("select intCountry_id from Country_Master where txtCountry_name='" + country + "'", con); string countryId = Convert.ToString(cmd.ExecuteScalar()); con.Close(); ds1 = new DataSet(); string x = Convert.ToString(countryId); ds1 = countries.GetState(x); ddlstate.DataSource = ds1; ddlstate.DataBind(); ddlstate.Items.Insert(0, "Select State"); }
/// <summary> /// when country change states loaded /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void state_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds = new DataSet(); string y = country.SelectedItem.Value.ToString(); ds = countries.GetState(y); if (ds.Tables[0].Rows.Count > 0) { for (int i = 1; i <= ds.Tables[0].Rows.Count; i++) { state.Items.Add(""); state.Items[i].Text = ds.Tables[0].Rows[i - 1]["txtState"].ToString(); state.Items[i].Value = ds.Tables[0].Rows[i - 1]["intState_id"].ToString(); } } ModalPopupExtender2.Show(); }
protected void Country_Change(object sender, EventArgs e) { ds = new DataSet(); string x = Convert.ToString(ddlCountry.SelectedValue); ds = countries.GetState(x); ddlstate.DataSource = ds; ddlstate.DataBind(); ddlstate.Items.Insert(0, "Select State"); }
protected void ddlcountry_SelectedIndexChanged(object sender, EventArgs e) { StateCountry coun = new StateCountry(); string x = ddlcountry.SelectedItem.Value.ToString(); DataSet ds1 = new DataSet(); ds1 = coun.GetState(x); if (ds1.Tables[0].Rows.Count > 0) { for (int i = 1; i <= ds1.Tables[0].Rows.Count; i++) { ddljobloc.Items.Add(""); ddljobloc.Items[i].Text = ds1.Tables[0].Rows[i - 1]["txtState"].ToString(); ddljobloc.Items[i].Value = ds1.Tables[0].Rows[i - 1]["intState_id"].ToString(); } } }