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

[Solved] Error when grouping/sorting and asynchronous

2 Answers 173 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ben
Top achievements
Rank 1
Ben asked on 23 Jul 2009, 07:47 PM
Hello,

I am running into an error using the Q2 2009 release of RadControls for Silverlight.  I currently have a simple SIlverlight application that uses Linq to Sql and a WCF service to retrieve data to populate the RadGridView.  I am able to successfully load the RadGridView with data, but if i try to group or sort, I receive the error below:

Message: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.InvalidCastException: Unable to cast object of type 'Telerik.Windows.Data.DataRecord' to type 'Telerik.Windows.Data.GroupRecord'.
   at Telerik.Windows.Controls.DataControl.FindRecord(Object dataItem)
   at Telerik.Windows.Controls.GridView.GridViewDataControlExtensions.GetContainerFromDataItem(GridViewDataControl dataControl, Object item)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.SetIsCurrent(Object item, Boolean isCurrent)
   at Telerik.Windows.Data.Selection.SelectionHandler.SetCurrentItemCore(Object item)
   at Telerik.Windows.Data.Selection.SelectionHandler.InitializeCurrentItem()
   at Telerik.Windows.Controls.DataControl.InitializeSelection()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.InitializeSelection()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnAsyncDataLoadWorkerWorkCompleted(Object sender, RunWorkerCompletedEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
   at System.ComponentModel.BackgroundWorker.<OnRun>b__1(Object state)    

Line: 56
Char: 13
Code: 0



Any help would be greatly appreciated,

Ben

 

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 29 Jul 2009, 01:21 PM
Hello Ben,

Do you refer to DataLoadMode="Asynchronous"? If this is the case please turn it off temporary and let me know about the result. Generally for binding with services you do not need this since the service itself is asynchronous and if you want to show the grid loading indicator you can use directly IsBusy property of GridViewDataControl.

Let me know how it goes.

Greetings,
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.
0
Ben
Top achievements
Rank 1
answered on 29 Jul 2009, 01:24 PM
That fixed it.  Thanks Vlad.

Also, good call with the IsBusy indicator.  Works nicely as well.

Ben
Tags
GridView
Asked by
Ben
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ben
Top achievements
Rank 1
Share this question
or