protected void DdlState_SelectedIndexChanged(object sender, EventArgs e) { DataTable objCityTable = MyJobPortalModel.City.GetCityRecords("stateId=" + DdlState.SelectedValue + "and status='Active'"); DdlCity.DataSource = objCityTable; DdlCity.DataBind(); DdlCity.Items.Insert(0, new ListItem("--Select City--", "--Select--")); }
public void BindCity(string sid) { DdlCity.DataTextField = "name"; DdlCity.DataValueField = "id"; DataView dv = new DataView(ds.Tables["City"]); dv.RowFilter = "sid = " + sid; DdlCity.DataSource = dv.ToTable(); DdlCity.DataBind(); }
protected void DdlCountry_SelectedIndexChanged1(object sender, EventArgs e) { if (DdlCountry.SelectedIndex == 0) { DdlCity.Enabled = false; DdlCity.SelectedIndex = 0; } else { DdlCity.Enabled = true; SqlParameter parameter = new SqlParameter("@countryId", DdlCountry.SelectedValue); DataSet ds = getData("spGetCityByCountryId", parameter); DdlCity.DataSource = ds; DdlCity.DataBind(); ListItem itemCity = new ListItem("Select City", "-1"); DdlCity.Items.Insert(0, itemCity); } }