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

ResumeBinding

Hi, I call suspend binding before I make bulk updates to the grid. However, when I call resume binding the state of expanded rows is lost and they are all collapsed. Why does this happen? And how can I prevent it? Cheers

6 Replies

AD Administrator Syncfusion Team December 2, 2005 04:44 PM UTC

What grid are you using? This will happen in a GridDataBoundGrid but should probably not happen in a GridGroupingControl (depending on what exactly you are doing). In a GridDataBoundGrid, then you woul dhave to save the expand states before the updates and restore them afterwards. This takes some coding. Here is forum thread that discusses saving the expand state during a sort. I think you can use a similar techique for this problem. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16065


CD Christopher Dugdale December 2, 2005 06:11 PM UTC

Yes it is a GDBG. Does doing a ResumeBinding cause the Grid to reset?


AD Administrator Syncfusion Team December 2, 2005 07:11 PM UTC

If you have this flag set, grid.OptimizeListChangedEvent = true, then yes, it does cause a reset. public void ResumeBinding() { if (suspendBinding > 0) { if (--suspendBinding == 0) { if (this.OptimizeListChangedEvent) { if (suspendChangeFlags != 0) { suspendChangeFlags = 0; this.bindingList_ListChanged(this.List, new ListChangedEventArgs(ListChangedType.Reset, -1, -1)); } } else { gridModel.BeginUpdate(); if ((this.suspendChangeFlags & MetaDataChangedFlag) != 0) { MetaDataChanged(); } else if ((this.suspendChangeFlags & DataSourceChangedFlag) != 0) { listManager_Changed(this.listManager, EventArgs.Empty); } else if ((this.suspendChangeFlags & DataSourceRowChangedFlag) != 0) { listManager_CurrentChanged(this.listManager, EventArgs.Empty); } else if ((this.suspendChangeFlags & DataSourcePositionChangedFlag) != 0) { listManager_PositionChanged(this.listManager, EventArgs.Empty); } suspendChangeFlags = 0; gridModel.EndUpdate(); } } } }


CD Christopher Dugdale December 5, 2005 12:05 PM UTC

Hi, I have multiple updates(around 60) being performed on the GDBG approx every 250 - 500 ms. During the update phase I call BeginUpdate and SuspendBinding and then EndUpate and ResumeBinding upon completion of the update to the underlying data. I presume it would be a large processing overhead to have OptimizeListChangedEvent set to true as a call to ResumeBinding would then cause a full reset on a frequent basis? The frequency of this would be inefficient? However, without OptimizeListChangeEvent set to true, the grid does not reflect any of the underlying data chanages after I call EndUpdate and ResumeBinding. How can I then get the grid to update itself or is a reset the only way?


AD Administrator Syncfusion Team December 5, 2005 02:57 PM UTC

After calling EndUpdate, try also calling grid.Refresh to see if this will allow the new values to be seen.


CD Christopher Dugdale December 5, 2005 05:09 PM UTC

That works great. And the fact a reset hasn''t occured also means I dont lose the expanded/collapsed row state which is good. However to execute refresh on average takes 500 to 600 ms. This appears to interfere and delay other GUI events/messages such as keypress and mouse click events. Are there any tricks to improve this refresh time or improve the processing of other messages on the message pump? Thanks for your help!

Loader.
Live Chat Icon For mobile
Up arrow icon