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:
Club selectedItem = this.clubsGrid.SelectedItem as Club; this.clubsGrid.Items.EditItem(selectedItem);
Dim selectedItem As Club = TryCast(Me.clubsGrid.SelectedItem, Club) Me.clubsGrid.Items.EditItem(selectedItem)
- Modify the object and then call the CommitEdit() method of the Items collection:
selectedItem.Name = "new Name of the item"; this.clubsGrid.Items.CommitEdit();
selectedItem.Name = "new Name of the item" Me.clubsGrid.Items.CommitEdit()
That's it - the RadGridView will show the updated data immediately.