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" && gvDealer.FocusedRowHandle >= 0) { ObjDealer = new Dealer(); ObjDealer.DEALERID = gvDealer.GetFocusedRowCellValue("DEALERID"); ObjDealer.UserID = Utility.UserID; objMasterRep.DeleteDealer(ObjDealer); gvDealer.DeleteRow(gvDealer.FocusedRowHandle); } } catch (Exception ex) { ErrorMgmt.ShowError(ex); ErrorMgmt.Errorlog.Error(ex); } }