We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bound Data Not Changed before Model.ClipboardPasted Event Fires

Thread ID:





25364 Feb 24,2005 11:06 PM UTC Feb 25,2005 01:00 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On February 24, 2005 11:06 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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

Jeff Lancaster
Replied On 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

Administrator [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon