private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdViewCar.RowCount - 1 != grdViewCar.FocusedRowHandle) { return; } if (MessageBox.Show("Do You want to Delete?", "Car Park", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { iSlots = Convert.ToInt32(CommFun.IsNullCheck(txtSlots.Text, CommFun.datatypes.vartypenumeric)); iSlots = iSlots - 1; if (iSlots < 0) { iSlots = 0; } UnitDirBL.DeleteCarSlots(m_iCCId, iBlockId, iTypeId, Convert.ToInt32(grdViewCar.GetFocusedRowCellValue("SlotNo"))); grdViewCar.DeleteSelectedRows(); txtSlots.EditValue = iSlots; } }