private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { var dlgResult = XtraMessageBox.Show("Are you sure want to delete?", "Confirmation!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (Convert.ToString(dlgResult) == "OK" && gvMOP.FocusedRowHandle >= 0) { ObjMOP = new MOP(); ObjMOP.MOPID = gvMOP.GetFocusedRowCellValue("MOPID"); ObjMOP.UserID = Utility.UserID; ObjMasterRep.DeleteMOP(ObjMOP); gvMOP.DeleteRow(gvMOP.FocusedRowHandle); } } catch (Exception ex) { ErrorMgmt.ShowError(ex); ErrorMgmt.Errorlog.Error(ex); } }