Deleting Large Number of Items Issue

3 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    16 posts
    Member since:
    May 2014

    Posted 07 Mar 2016 Link to this post


    I have a grid view bound to a RadObservableCollection that contains around a million items. when I select all items and delete them from the grid view (using telerik:RadGridViewCommands.Delete), the whole application freezes and stops responding. I tried all the tricks and tips for optimizing the grid view, but that didn't help.

    How do I solve the issue?


  2. Ahmed
    Ahmed avatar
    16 posts
    Member since:
    May 2014

    Posted 07 Mar 2016 in reply to Ahmed Link to this post

    Note: The issue happens only when the number of selected items is large.
  3. Stefan Nenchev
    Stefan Nenchev avatar
    665 posts

    Posted 08 Mar 2016 Link to this post

    Hello Ahmed,

    I am adding my reply to your ticket in this forum thread as well.

    Indeed, deleting 1 000 000 records from the RadGridView takes a large amount of time to complete. As you are using RadObservableCollection as ItemsSource, you can get the benefits of its AddRange method as when it is applied all notifications to the RadGridView are suspended and thus the performance is boosted:

    private void RadButton_Click_1(object sender, RoutedEventArgs e)
                var items = this.DataParametersGridView.ItemsSource asRadObservableCollection<DataParameter>;
                var itemsToRemove = new ObservableCollection<DataParameter>();
                foreach (DataParameter item inthis.DataParametersGridView.SelectedItems)

    The aforementioned approach decreases the time for the items deletion. Still, as 1 000 000 items is a pretty huge number, there is some significant period of waiting. If you need to clear all the items from the collection, I suggest you use its Clear method directly:

    (this.DataParametersGridView.ItemsSource as RadObservableCollection<DataParameter>).Clear();

    Stefan Nenchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top