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
1080
Jump back to originally selected row after data refresh
posted

I have a xamDataGrid which is populated using a Dataset. I have a situation where I need to refresh the data (by setting the Datasource = null, update the data in the dataset and set the Datasource to the dataset again). My customer now whishes that the row selected before the refresh should als be selected after the refresh. How can this be done?

Perhaps someone has solved a similar problem already.

Thank you in advance for any help

Markus

Parents
  • 9836
    Verified Answer
    posted

    There are couple of ways to do this. You can store the index of the last selected record in a custom integer variable and then use the Records collection to resolve the selected record after rebinding e.g.:

    xdg1.Records[index].IsSelected=true;

    In addition, the grid exposes a SelectedItem.Records collection that can be used to add/remove records programatically and SelectedItemsChanging/ed events that might be helpfull in determine the current selected records in the grid.

    Let me know if you have any questions with this matter.

Reply Children
No Data