I have a GDBG in which I am using the CurrentCellAcceptedChanges event to determine when the user modifies the contents of a cell and then call routines which validate and use the updated bound record. Since this event does not fire when cells are modified in a paste, I am trying to use the Model.ClipboardPasted event to call these routines for each pasted cell. Unfortunately, it appears that even though the cell values have visually changed, the bound records have not yet been updated at the time this event fires. Is there a way I can force these updates to occur after the paste, or perhaps an alternative way to solve this problem?
ADAdministrator Syncfusion Team February 24, 2005 06:25 PM
You can try calling grid.Binder.EndEdit() to see if that will handle the problem you are seeing.
ADAdministrator Syncfusion Team February 24, 2005 06:38 PM
Thanks for the response, Clay. However, that doesn''t seem to work. By the way, I have DataBoundGridModel.Binder.DirectSaveCellInfo = True set for this grid, so I didn''t think I needed to call Binder.EndEdit to get changes committed. Would you perhaps have another suggestion?
JLJeff LancasterFebruary 24, 2005 07:14 PM
Here is some more info on this problem: It turns out that if I select a range of multiple cells and cut and paste, the changes are applied and everything works fine. Apparently, this is only a problem when I cut and paste a single cell. Here is the code I am using when the Model.ClipboardPasted event fires:
Dim rowIndx As Integer
Dim colIndx As Integer
Dim PasteRange = m_grid.Model.SelectedRanges(0)
m_grid.Model.SelectedRanges(0) = PasteRange.ExpandRange(1, 2, Grid.Model.RowCount, Grid.Model.ColCount)
If PasteRange.GetFirstCell(rowIndx, colIndx) Then
Loop While PasteRange.GetNextCell(rowIndx, colIndx)
The problem I am having is in the UpdateCellData routine which operates on the bound data. After pasting a single cell, the bound data does not always reflect the latest changes at this point.
ADAdministrator Syncfusion Team February 24, 2005 08:00 PM
If you are pasting a single cell, try calling
Here is a sample. http://www.syncfusion.com/Support/user/uploads/GDBG_Pasted_6f914982.zip