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" && gvUOM.FocusedRowHandle >= 0) { ObjUOM = new UOM(); ObjUOM.UOMID = gvUOM.GetFocusedRowCellValue("UOMID"); ObjUOM.UserID = Utility.UserID; objMasterRep.DeleteUOM(ObjUOM); gvUOM.DeleteRow(gvUOM.FocusedRowHandle); } } catch (Exception ex) { ErrorMgmt.ShowError(ex); ErrorMgmt.Errorlog.Error(ex); } }