private void btnEditState_Click(object sender, EventArgs e) { try { frmAddEditState frm = new frmAddEditState(this.SelectedStateID); if (frm.ShowDialog() == DialogResult.OK) { PopulateStatesGrid(); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "pageLocations::btnEditState_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddNewState_Click(object sender, EventArgs e) { try { frmAddEditState frm = new frmAddEditState(); frm.SelectedCountryID = this.selectedCountryID; // frm.CountryID = this.SelectedCountryID; if (frm.ShowDialog() == DialogResult.OK) { selectedStateID = frm.StateID; PopulateStatesDropdown(); cboStates.SelectedItem = ((List <SelectListItem>)cboStates.DataSource).Where(x => x.ID == selectedStateID).FirstOrDefault(); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmAddEditAddress::btnAddNewState_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }