private void btnContinue_Click_1(object sender, EventArgs e) { frmDivisionDetail frmDD = new frmDivisionDetail(); frmDD.setFunction(1); var rowHandle = gridView1.FocusedRowHandle; frmDD.setEmployee(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "EmployeeID").ToString())); frmDD.ShowDialog(); if (frmDD.DialogResult == DialogResult.OK) { this.DialogResult = DialogResult.OK; this.Close(); } }
private void btnEdit_Click(object sender, EventArgs e) { frmDivisionDetail frmDD = new frmDivisionDetail(); frmDD.setFunction(2); var rowHandle = gridView1.FocusedRowHandle; try { frmDD.setEmployee(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "EmployeeID").ToString())); frmDD.setDivision(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "DivisionID").ToString())); } catch { var rowChild = gridView1.GetChildRowHandle(rowHandle, 0); frmDD.setEmployee(Convert.ToInt32(gridView1.GetRowCellValue(rowChild, "EmployeeID").ToString())); frmDD.setDivision(Convert.ToInt32(gridView1.GetRowCellValue(rowChild, "DivisionID").ToString())); } frmDD.ShowDialog(); if (frmDD.DialogResult == DialogResult.OK) { FillGridControls(); } }