Hi,
I have this WinGrid which is bound to a DataSet which has 2 tables with parent child relationship. There is a group by also which produces a 2 level grid. After an update function call which updates the data in database i try to relaod or refresh the grid but it appears the grid is clinging or retaining some of the grouping properties. So i do not get the correct grouping though the datasource is absolutely correct. Also when i re start the application, updated data comes up correctly. Is there a way to completey refresh the WinGrid so it becomes as if it is a fresh instance as it is when the application starts?
Cheers,
SK
Try calling this line first:
grid.SetDataBinding(null, string.Empty);
Then, use the grid's SetDataBinding() method again to point to your grid's new DataSource and DataMember.
This may not get you exactly the same results as when the application starts, if you'd done any formatting at design-time. You'd have to do this formatting in the InitializeLayout event for it to be re-applied whenever you clear the data source.
It does not solve the problem. Its still the same. After i update data in the database and reset the datasource the grid should should show the group by and bands under group by correctly as it is supposed to, but it seems its retaining the previous data relationship as after i clear the DataSet and re populate Dataset and set the grid data source again it shows the previous row and because of which i get exceptions. I am using a single DataSet object which iam re populating with data from database after update. I am not using any design time settings. Group by is done using Sorted Columns.
Got it. I needed to use a different instance of my DataSet i.e. create a new Dataset instance and re populate it and set as source. It seems i am ending up answering most of my posts.