This is a migrated thread and some comments may be shown as answers.

Asynchronous loading blocks of data

1 Answer 259 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Casey Watson
Top achievements
Rank 1
Casey Watson asked on 10 Jul 2009, 06:54 PM
I'm populating a RadGridView with data that comes in asynchronously from a WCF service. The service sends blocks of records, say 200 at a time, which are then put into an ObservableCollection which is bound to the ItemsSource property of the grid. I would like to turn on Asynchronous loading of the data (DataLoadMode=Asynchronous), but when I do this, I get the following exception:

Collection was modified; enumeration operation may not execute.

at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)  
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()  
at System.Collections.Generic.List`1.Enumerator.MoveNext()  
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()  
at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList() in c:\\Builds\\WPF_Scrum\\Core_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 423  
at Telerik.Windows.Data.QueryableCollectionView.get_InternalList() in c:\\Builds\\WPF_Scrum\\Core_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 406  
at Telerik.Windows.Data.QueryableCollectionView.GetEnumerator() in c:\\Builds\\WPF_Scrum\\Core_WPF\\Sources\\Development\\Core\\Data\\Collections\\QueryableCollectionView.cs:line 269  
at Telerik.Windows.Data.RecordFactory.<CreateRecordsForGroupRecord>d__0.MoveNext() in c:\\Builds\\WPF_Scrum\\Core_WPF\\Sources\\Development\\Core\\Data\\Data\\Records\\RecordFactory.cs:line 28  
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)  
at Telerik.Windows.Controls.GridView.GridViewDataControl.PopulateRecords() in c:\\Builds\\WPF_Scrum\\GridView_WPF\\Sources\\Development\\Controls\\GridView\\GridView\\GridView\\GridViewDataControl.cs:line 3178  
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnAsyncDataLoadWorkerDoWork(Object sender, DoWorkEventArgs e) in c:\\Builds\\WPF_Scrum\\GridView_WPF\\Sources\\Development\\Controls\\GridView\\GridView\\GridView\\GridViewDataControl.cs:line 3153  
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)\r\n   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)" 

This is with the Q2 2009 release of the WPF controls.

The datasource will be continually updated and changed as records are added and deleted to it.

Any ideas on how I can get this to work safely?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 13 Jul 2009, 05:51 AM
Hello Casey,

Since your data are populated asynchronously you do not need the grid asynchronous load mode. If you want to show the grid loading indicator you can use IsBusy property of the grid.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Casey Watson
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or