Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
550
How to clear the WinGrid Completely i.e. make it = to a fresh instance?
posted

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

Parents
  • 45049
    posted

    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.

Reply Children