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

[Solved] TypeAccessException when sorting using RIA Services

0 Answers 105 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.
Mark Shortt
Top achievements
Rank 1
Mark Shortt asked on 29 Aug 2011, 01:56 PM
Hi

I'm using RadGrid in a SL app using RIA services / MVVM

In my Viewmodel I have an IEnumerable collection that works fine when simply exposing the collection:

    public IEnumerable<Orders> OrderList
        {
            get
            {
                return datacontext.Orders;
            }
        }

However, when I try to sort the collection before it's bound (as follows)  I get an error "Message: System.typeaccessexception  Attempt by method DynamicClass.lambda ..... " and the application hangs:

    public IEnumerable<Orders> OrderList
        {
            get
            {
                return  datacontext.Orders.OrderBy(o=>o.OrderDate);
            }
        }

Can you advise how to expose the data sorted without causing this issue?

Tags
GridView
Asked by
Mark Shortt
Top achievements
Rank 1
Share this question
or