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.
Unfortunately, activation email could not send to your email. Please try again.

Correct Way to Refresh a GGC after underlying data has changed

Thread ID:

Created:

Updated:

Platform:

Replies:

75032 Jul 9,2008 08:49 AM Jul 10,2008 07:54 AM Windows Forms 1
loading
Tags: GridControl
Kevin Bechard
Asked On July 9, 2008 08:49 AM

We are using GGC version 6.3.0.6 and we are looking for advice on the best way to refresh the grid when the underlying data has changed.

This is the method that we currently use but it does not seem to work all of the time:

public void UpdateRecordsWithBackendData(RecordsInTableCollection records)
{
foreach (Record record in records)
{
// Force end on the current record
record.EndEdit();

// Get the back end data
record.EnsureValues();

// Purge the cache
record.ResetValues();
}
}


SubhaSheela R [Syncfusion]
Replied On July 10, 2008 07:54 AM


Hi Kevin,

Thanks for your interest in Syncfusion products.

Rebindng Datatable
you have to reset the DataSource before rebinding it. The best way to do this would be calling the grid.BeginUpdate() and grid.Binder.SuspendBinding() before you modify the underlying DataSource and call grid.Binder.ResumeBinding() and grid.EndUpdate() after that.

The SuspendBinding and ResumeBinding are two methods that allow the temporary suspension and resumption of data binding. You would typically suspend data binding if you want to make several changes to the data source without immediately updating the grid after each change.

For example, if you want to clear out all records in your data set and refill it with its original data, you can improve performance of this operation substantially if the grid does not need to immediately reflect every row change in the grid while the data set is filled.

BeginUpdate method suspends the painting of associated grid controls until the EndUpdate method is called.

Also, call grid.Binder.ResetHierarchyLevels() if you have changed the underlying data source and you had several relations added. Below is the code snippet:


this.gridDataBoundGrid1.BeginUpdate();
this.gridDataBoundGrid1.DataSource = null;
this.gridDataBoundGrid1.DataMember = null;
this.gridDataBoundGrid1.Binder.ResetHierarchyLevels();
this.gridDataBoundGrid1.Binder.InternalColumns.Clear();
this.gridDataBoundGrid1.DataSource = ds;
this.gridDataBoundGrid1.DataMember = "ParentTable";
this.gridDataBoundGrid1.EndUpdate();


Changing the underlying data only

Calling the grid.Engine.ResetTable() in the button event handler will help you to make the proper values appear.


this.gridGroupingControl1.Engine.ResetTable();


Please let me know if it helps.

Regards,
Subhasheela R





CONFIRMATION

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.

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.

;