protected void LnkBtnEditState_Click(object sender, EventArgs e) { EditStateModal.Visible = true; DataTable ObjCountryTable = MyJobPortalModel.Country.GetCountryRecords("status='Active'"); DdlCountryEdit.DataSource = ObjCountryTable; DdlCountryEdit.DataBind(); DdlCountryEdit.Items.Insert(0, new ListItem("--Select--", "--Select--")); GridViewRow ObjCurrentRow = (GridViewRow)((LinkButton)sender).Parent.Parent; int Id = (int)GridView1.DataKeys[ObjCurrentRow.RowIndex]["Id"]; HdnStateId.Value = Id.ToString(); MyJobPortalModel.State ObjState = new MyJobPortalModel.State(Id); TxtStateNameEdit.Text = ObjState.StateName; DdlCountryEdit.SelectedValue = ObjState.CountryId.ToString(); DdlStatusEdit.SelectedValue = ObjState.Status; TxtStateNameEdit.Focus(); this.Form.DefaultButton = BtnUpdateState.UniqueID; }
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(); }