May 26

If you are using a data pager on your view in a Silverlight application, when you run it and try to click the next page button couple of times you may get an error like this:

DataPager Error

This is because the query is stateless and without an order, it is not possible to do a valid skip.

So, for the datapager to work correctly, you need to provide an “order by” to your returned resultset.

Assuming that you are using DomainServices, go to your domain service and find the Get() method. This could be GetCustomers, GetOrders etc.

The code you will see is something like below:

 public  IQueryable <Customers > GetCustomers()
 {
     return  this .ObjectContext.Customers;
 }

Change this to:

 public  IQueryable <Customers > GetCustomers()
 {
     return  this .ObjectContext.Customers.OrderBy(c => c.CustomerID);
 }

And you have your data pager working nicely.