private void btnNew_Click(object sender, EventArgs e) { fDesignation frm = new fDesignation(); frm.ItemChanged = RefreshList; frm.ShowDlg(new Designation(), true); }
private void btnEdit_Click(object sender, EventArgs e) { DEWSRMEntities db = new DEWSRMEntities(); int[] selRows = ((GridView)grdDesignation.MainView).GetSelectedRows(); DataRowView oDesignationID = (DataRowView)(((GridView)grdDesignation.MainView).GetRow(selRows[0])); int nDesignationID = Convert.ToInt32(oDesignationID["DesignationID"]); Designation oDesignation = db.Designations.FirstOrDefault(p => p.DesignationID == nDesignationID); if (oDesignation == null) { MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } fDesignation frm = new fDesignation(); frm.ItemChanged = RefreshList; frm.ShowDlg(oDesignation, false); }