This is a migrated thread and some comments may be shown as answers.

[Solved] Refresh grid after updating ItemSource object in code

2 Answers 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anne Lyon
Top achievements
Rank 1
Anne Lyon asked on 26 Oct 2010, 12:25 PM
Hi,

How do I get a grid to update itself when I have programmatically changed the value of a property in the underlying business object/item source?
. I.e. I get the SelectedItem from my grid and assign that to a BusinessObject. I change the value of a property of this object. The SelectedItem now contains this changed property, but the grid displays the original value. The only way to get the grid to display the changed property is to copy the ItemSource to a temporary Object, then clear the ItemSource and finally reassign the temporary Object back to the ItemSource. BUT by doing this the Grid scrolls to the top and I loose my position /current viewport.
How can I get the grid to refresh, i.e. display changes in properties of an underlying ItemSource's BusinessObject without re-displaying the grid?

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor Georgiev
Telerik team
answered on 26 Oct 2010, 12:26 PM
Hello Anne Lyon,

 Does your BusinessObject implement INotifyPropertyChanged?

Greetings,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anne Lyon
Top achievements
Rank 1
answered on 26 Oct 2010, 12:42 PM
No, it doesn't, and that of course did the trick. Sorry for wasting your time, sometimes one can stare oneself blind at a problem! Thanks!
Tags
GridView
Asked by
Anne Lyon
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Anne Lyon
Top achievements
Rank 1
Share this question
or