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
245
active row is reset after datasource change
posted

Hello,

I have a hierarchical grid bound to a hierarchical data source. When I need to change the hierarchy, i modify the datasource then re-set the datasource property on the grid, but the problem is when i do this, the users current location gets reset, and all the bands collapse which is very annoying. Is there a better way to rebind the grid after the hierarchy changes? I tried Refresh, Rebind, but that doesn't work.

 

Thanks

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    If you set (or re-set) the DataSource on the grid, all of the grid rows are destroyed and a completely new set of rows are created based on the new data source. So there is no way that the grid can maintain any kind of row or cell level state information, such as the ActiveRow, SelectedRows, or Expanded states of the rows.

    The best thing to do is to avoid resetting the data source whenever possible.

    What kind of DataSource are you using for the grid? And what kind of changes are you making to the structure of the data?

    If you are using a DataSource that implements IBindingList, then you should not have to reset the grid's DataSource, because the DataSource will notify the grid of any changes in structure and the grid will update automatically.

Children