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?
Thanks,
Jeff
AD
Administrator
Syncfusion Team
February 24, 2005 11:25 PM UTC
You can try calling grid.Binder.EndEdit() to see if that will handle the problem you are seeing.
AD
Administrator
Syncfusion Team
February 24, 2005 11:38 PM UTC
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?
Jeff
JL
Jeff Lancaster
February 25, 2005 12:14 AM UTC
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
Do
UpdateCellData(rowIndx, colIndx)
Loop While PasteRange.GetNextCell(rowIndx, colIndx)
End If
m_grid.Model.Refresh()
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.
Thanks Again,
Jeff
AD
Administrator
Syncfusion Team
February 25, 2005 01:00 AM UTC
If you are pasting a single cell, try calling
grid.CurrentCell.EndEdit();
grid.Binder.EndEdit();
Here is a sample. http://www.syncfusion.com/Support/user/uploads/GDBG_Pasted_6f914982.zip