Data Management Overview

Telerik's RadGridView allows you not only to display sets of data, but also to manage them. You are able to use the standard operations - Insert, Update and Delete. You can also validate the data. Besides using this functionality, you are able to control it via the several events raised at the most important key points of the operation.

Managing Collections

Some data sources, such as those implementing INotifyCollectionChanged(ObservableCollection), support data inserts, change notifications and etc. This means that they will automatically handle the creation of new objects in the collection and send notifications to the DataBinding engine that the data has changed. When using collections that don't support inserts and change notifications as data source, you have to create the new items manually and rebind the grid to the modified data source to display the modified data.

When DataTable is needed as a source collection of RadGridView, it is recommended to use its DefaultView property. It raises a notification for a collection change and its DataRowView implements INotifyPropertyChanged interface, thus the UI will be updated out-of-the-box.

Adding New Entries

The adding of new entires is achieved via the GridViewNewRow control, which appears when the user hits the "Insert" key or when the developer initiate an add operation. To learn more about how to add items to your RadGridView control take a look at the Adding New Entries topic.

Updating an Entry

The updating of entries takes place in the same cell, where the data is displayed. Only one item and only one cell in it can be edited at a time. You are able to restrict certain cells or the entire grid from being edited. To edit a cell the user can hit the "F2" key or the developer can initialize an edit operation. To learn more about how to add items to your RadGridView control take a look at the Updating an Entry topic.

Deleting an Entry

You are able to remove items from the RadGridView by manipulating the ItemsSource collection. To learn how to do it and what other features can be used when determining the items to remove take a look at the Deleting an Entry topic.

Validation

Tha RadGridView allows you to validate the data entered in the managed cells by applying custom validating rules. You can validate for each cell or validate the whole row at a time. To learn how to implement the validation take a look at the Validation topic.

Events

The data editing model of the RadGridView provides an editing process which consists of several steps. Each step is supplemented by an event on RadGridView control. These events allow the developer to inject custom logic in the editing process and control it as required. The events related to the editing logic are:

  • GridViewDataControl.BeginningEdit - occurs when the cell is about to enter into EditMode (can be cancelled).

  • GridViewDataControl.PreparingCellForEdit - occurs when the cell is entering edit mode (can be cancelled).

  • GridViewDataControl.PreparedCellForEdit - occurs when the cell is prepared for edit.

  • GridViewDataControl.RowValidating - occurs when a row is about to commit new content (can stop commit process of the row).

  • GridViewDataControl.RowValidated - occurs when a row has validated the new content.

  • GridViewDataControl.CellValidating - occurs when a cell is about to commit new content (can stop commit process of the cell).

  • GridViewDataControl.CellValidated - occurs when a cell has validated the new content.

  • GridViewDataControl.CellEditEnded - occurs when a cell validation is passed successfully and new data is committed to the RadGridView.ItemsSource.

  • GridViewDataControl.RowEditEnded - occurs when a row validation has passed successfully and new data is committed to the RadGridView.ItemsSource.

To learn more about the events in the RadGridView take a look at the Events topic.

See Also

In this article