private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { var dc = new ClassSRMDataContext(Config.connection); int id = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Id"); int idStu = (int)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "StudentId"); bool exist = (bool)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Exist"); var date = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Date").ToString(); if (exist) { exist = false; } else { exist = true; } dc.UpdateCheck(id, idStu, exist, date); checkVBindingSource.EndEdit(); dc = new ClassSRMDataContext(Config.connection); XtraMessageBox.Show("حضورغیاب موردنظر با موفقیت ویرایش شد", "توجه", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { } }