This question is locked. New answers and comments are not allowed.
Hello,
We are required to restore the sorting order that was entered by the user. To accomplish this, we are currently saving the sortdescriptors of the grid to a database and loading them when the page is opened. This persistence works fine, but when attempting to restore the sortdescriptors on the grid at runtime, we receive the following error:
System.CrossAppDomainMarshaledException was unhandled
Message: System.NullReferenceException: Object reference not set to an instance of an object.
at FleetFence2.App.Application_UnhandledException(Object sender, ApplicationUnhandledExceptionEventArgs e)
at MS.Internal.Error.CallApplicationUEHandler(Exception e)
at MS.Internal.Error.CallAUEHandler(UInt32 hr, UInt32& bIsHandled)
This error is thrown asynchronously (so not while on a certain line), but only occurs when the descriptors have been changed by the following piece of code:
Dim descriptor = New Telerik.Windows.Data.SortDescriptor() |
Dim datamember = DirectCast(column, GridViewDataColumn).DataMemberBinding.Path.Path |
descriptor.Member = datamember |
descriptor.SortDirection = If(lSortingState = Telerik.Windows.Controls.SortingState.Ascending, ListSortDirection.Ascending, ListSortDirection.Descending) |
grid.SortDescriptors.Add(descriptor) |
This piece of code is executed for each column that was marked to be sorted. The data that is used to instantiate the SortDescriptor is correct: the fields exists and the sortorder is valid.
Have you got any idea what can cause this error? The grid itself is bound to the Data property of a DomainDataSource control, using WCF Ria Services and LINQ To SQL.
Hoping you can help,
Dominiek