protected void DdlCountryEdit_SelectedIndexChanged(object sender, EventArgs e) { if (DdlCountryEdit.SelectedIndex != 0) { DataTable ObjStateTable = MyJobPortalModel.State.GetStateRecords("status='Active' and CountryId=" + DdlCountryEdit.SelectedValue); DdlStateEdit.DataSource = ObjStateTable; DdlStateEdit.DataBind(); DdlStateEdit.Items.Insert(0, new ListItem("--Select--", "--Select--")); } else { DdlStateEdit.Items.Clear(); DdlStateEdit.Items.Add(new ListItem("--Select--", "--Select--")); } EditCityModal.Visible = true; }
protected void LnkBtnEditCity_Click(object sender, EventArgs e) { EditCityModal.Visible = true; DataTable ObjCountryTable = MyJobPortalModel.Country.GetCountryRecords("status='Active'"); DdlCountryEdit.DataSource = ObjCountryTable; DdlCountryEdit.DataBind(); DdlCountryEdit.Items.Insert(0, new ListItem("--Select--", "--Select--")); DdlStateEdit.Items.Add(new ListItem("--Select--", "--Select--")); GridViewRow ObjCurrentRow = (GridViewRow)((LinkButton)sender).Parent.Parent; int Id = (int)GridView1.DataKeys[ObjCurrentRow.RowIndex]["Id"]; HdnCityId.Value = Id.ToString(); MyJobPortalModel.City ObjCityRecord = new MyJobPortalModel.City(Id); TxtCityNameEdit.Text = ObjCityRecord.CityName; DdlCountryEdit.SelectedValue = ObjCityRecord.CountryId.ToString(); DataTable ObjStateTable = MyJobPortalModel.State.GetStateRecords("status='Active' and CountryId=" + DdlCountryEdit.SelectedValue); DdlStateEdit.DataSource = ObjStateTable; DdlStateEdit.DataBind(); DdlStateEdit.Items.Insert(0, new ListItem("--Select--", "--Select--")); DdlStateEdit.SelectedValue = ObjCityRecord.StateId.ToString(); DdlStatusEdit.SelectedValue = ObjCityRecord.Status.ToString(); }