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.
Syncfusion Feedback

Refresh grid content after changing datasource

Thread ID:

Created:

Updated:

Platform:

Replies:

62003 Jun 6,2007 08:02 AM UTC Jun 7,2007 09:09 AM UTC Windows Forms 4
loading
Tags: GridControl
Mårten Lind
Asked On June 6, 2007 08:02 AM UTC

I'm changing the datasource for a gridgroupingcontrol in the following way:

m_BindingSource.DataSource = newDataSource;
m_GridControl.DataSource = m_BindingSource;

newDataSource contains a data table with a different column setup compared to the previous data table bound to the grid.

My problem is that I can't make the grid reload the values with the new data source correctly. The columns all show up OK but the content (cell values) is not correct.

I'm using stacked row headers and expression fields in the grid, and before rebuilding these (after changing the datasource) I do the following:
gridTableDescriptor.Columns.Reset(); gridTableDescriptor.ResetExpressionFields();
gridTableDescriptor.ResetStackedHeaderRows();

GridGroupingControl 5.102.0.51
VS.NET 2005

What is the correct way of reloading data in the GGC after changing datasource to a new data table with a different column setup?

Any suggestions greatly appreciated.

Regards
/Marten

haneefm [Syncfusion]
Replied On June 6, 2007 06:04 PM UTC

Hi Marten,

You can try this code snippets to reset the datasource for the grid and see if it helps.

[c#]
this.gridGroupingControl1.DataSource = null;
this.gridGroupingControl1.DataMember = null;
this.gridGroupingControl1.ResetTableDescriptor();
this.gridGroupingControl1.TableDescriptor.Relations.Clear();
this.gridGroupingControl1.DataSource = newdatasource;
this.gridGroupingControl1.Refresh();


Please refer the GridGroupingRebind sample in the browser samples shipped with the product.
[instal path]\Syncfusion\Essential Studio\4.4.0.51\windows\Grid.Grouping.Windows\Samples\FeatureSamples\GridGroupingRebind

This sample demonstrates the switching of datasources at runtime and how to reset the GridGroupingControl to its original empty state.

Best regards,
Haneef

Mårten Lind
Replied On June 6, 2007 08:03 PM UTC

Thanks Haneef,

Now it's working as expected.

Couldn't find the GridGroupingRebind sample for my GGC version (5.102.0.51). Any idea where I can find the sample you're refering too?

Cheers
/Marten

haneefm [Syncfusion]
Replied On June 6, 2007 08:57 PM UTC

Hi Marten,

Please find the attached sample below and let me know if this helps.
GridGroupingRebind.zip

Best regards,
Haneef

Mårten Lind
Replied On June 7, 2007 09:09 AM UTC

Hi again,

Thanks for the sample. My problem was solved when calling gridGroupingControl1.ResetTableDescriptor();

Thanks for a quick answer,

Cheers
/Marten

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.

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

;