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" && gvGST.FocusedRowHandle >= 0) { ObjGST = new GST(); ObjGST.GSTID = gvGST.GetFocusedRowCellValue("GSTID"); ObjGST.UserID = Utility.UserID; objMasterRep.DeleteGST(ObjGST); gvGST.DeleteRow(gvGST.FocusedRowHandle); } } catch (Exception ex) { ErrorMgmt.ShowError(ex); ErrorMgmt.Errorlog.Error(ex); } }