Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
I use telerik RadGridView in my project. I select a row and edit it in a separate form. but after edit I have to refresh whole grid if I see changes.

myGrid.Items.Refresh();

I use this code but this Refresh All Rows. I want a code to refresh only SelectedItem from grid and see the changes immediately.

What I have tried:

myGrid.Items.Refresh();
Posted
Updated 27-Aug-19 22:05pm

1 solution

I'm not an expert of Telerik controls, but you have to read documentation:
WPF DataGrid | Edit an item outside RadGridView | Telerik UI for WPF[^]
WPF DataGrid | CurrentItem, SelectedItem and SelectedItems | Telerik UI for WPF[^]
WPF DataGrid | Edit Events | Telerik UI for WPF[^]

This is what is stated there:
Quote:

Edit an item outside RadGridView



As you probably know, if you edit an item in RadGridView and the business object implements the INotifyPropertyChanged interface - the changes immediately reflect in RadGridView. To achieve the same result when editing an item outside the user interface of RadGridView you should follow a few simple steps:

Before editing the item, find it in the Items collection of the gridview and call the EditItem(item) method of the Items collection:
C#
Club selectedItem = this.clubsGrid.SelectedItem as Club; 
this.clubsGrid.Items.EditItem(selectedItem);


Modify the object and then call the CommitEdit() method of the Items collection:
C#
selectedItem.Name = "new Name of the item"; 
this.clubsGrid.Items.CommitEdit();


That's it - the RadGridView will show the updated data immediately.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900