Edit this page

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:

  1. 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);

VB.NET

Dim selectedItem As Club = TryCast(Me.clubsGrid.SelectedItem, Club)
Me.clubsGrid.Items.EditItem(selectedItem)
  1. 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();

VB.NET

selectedItem.Name = "new Name of the item"
Me.clubsGrid.Items.CommitEdit()

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