Working with Data
In this article we will discuss the following topics:
Loading Data
You can load data in six distinct ways to be displayed in RadGridView :
Displaying Data
After you've acquired your data, you have to set it as the ItemsSource of your RadGridView instance. The ItemsSource property recognizes any collection that implements IEnumerable.
For RadGridView to correctly respond to changes in your collection when you add or remove items through code-behind, and update the UI accordingly, you must ensure that the source collection implements the INotifyCollectionChanged interface.
Example 1: Setting RadGridView's ItemsSource
this.RadGridView.ItemsSource = SampleData.GetData();
Me.RadGridView.ItemsSource = SampleData.GetData()
Once you set the ItemsSource , RadGridView displays the data in columns, which are auto-generated by default. If you want, you can set RadGridView's AutoGenerateColumns property to False and manually create them. You can find more information regarding RadGridView columns in the following topic.
If you don't want to display all the data in one row you can use RadGridView's Row Details functionality to display additional information.
If the data you want to display is hierarchical you can display it in nested RadGridViews. You can learn more about creating a Hierarchical GridView in the following topic.
Resetting the ItemsSource collection will cause RadGridView's horizontal scrollbar to be set to the top. You can keep track of the scrollbar's VerticalOffset and reposition the scrollbar after the collection update to keep the original appearance.
Managing Data
RadGridView comes with out-of-the-box support for Insert, Update and Delete operations, as well as for data validation.
You can find more information about managing data in the following topics: