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

Refresh grid content after changing datasource 2018

Thread ID:





141239 Nov 30,2018 02:49 PM UTC Dec 4,2018 12:51 PM UTC WinForms 3
Tags: SfDataGrid
Asked On November 30, 2018 02:49 PM UTC

I have still a problems with sfDataGrid after change DataSource.
I fond a topic from 2007 https://www.syncfusion.com/forums/62003/refresh-grid-content-after-changing-datasource but it don´t working any more ;-)
So here my question: how I can completly reset a DataGrid to "zero status"
I try it with:
dGrid.DataSource = null;
so was ok... BUT if I using
dGrid.ShowBusyIndicator = true;
on the line
dGrid.Add(new GroupColumnDescription() { ColumnName = "DispayStatus" });
come error:
GroupColumnDescription already exist in DataGrid.GroupColumnDescriptions
I try also clear that (before Refresh) with:
but become error:
The object reference was not set to an object instance

Do you have some new update for this issue? Thanks

Deivaselvan Y [Syncfusion]
Replied On December 3, 2018 11:14 AM UTC

Hi Adam, 

Thank you for contacting Syncfusion support.

Setting SfDataGrid.DataSource to null is enough to reset a DataGrid to zero state. But while using busy indicator we have used BackgroundWorker to perform asynchronous operations. In such case, the reported issue will occur, since it tries to add the GroupColumnDescription before clearing the GroupColumnDescriptions collection. This behavior is confirmed as a defect and it will be fixed in our 2018 Volume 4 SP1 release which is expected to be rolled out in the end of January 2019. 

However, you can resolve this issue by clearing the GroupColumnDescriptions collection before adding a GroupColumnDescription. It is advisable to clear all the collections related to the MappingName of the columns as given in the code example. Please refer the following code example and sample from the given location. 

Code example:  

private void OnRefreshButtonClick(object sender, System.EventArgs e) 
    this.sfDataGrid.DataSource = null; 
    this.sfDataGrid.DataSource = data.OrdersListDetails; 
      new Syncfusion.WinForms.DataGrid.GroupColumnDescription() 
          ColumnName = "OrderID" 


Replied On December 4, 2018 08:03 AM UTC

Working very well
Thank you :-)

Deivaselvan Y [Syncfusion]
Replied On December 4, 2018 12:51 PM UTC

You are welcome. 


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