Question

I have a Silverlight 3 app with RIA Services and I'm running into an issue where my DataPager is only loading data for the initial loadsize and then no longer reloading. It brings up two pages of data (PageSize=10, LoadSize=20.) It is correctly showing 119 pages of data but when I navigate to page 3, nothing appears in my datagrid and dataforms.

This is my Domain Data Source:

<riaControls:DomainDataSource x:Name="_dds" QueryName="GetCaseLoads" AutoLoad="True" PageSize="10" LoadSize="20">
    <riaControls:DomainDataSource.DomainContext>
        <domain:FooContext />
    </riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>

Here's the snippet for the DataPager:

<data:DataPager Source="{Binding Data, ElementName=_dds}" />

And here's the Domain Service query:

[RequiresAuthentication()]
public IQueryable<CaseLoad> GetCaseLoads()
{
    // Return all case loads
    return this.Context.CaseLoadSet;
}

It's pretty straightforward so I'm not sure what's missing. Any help would be appreciated;

Was it helpful?

Solution

After spending way too much time trying to get this working I FINALLY figured out the problem, which I think is more of a bug with the RIA Services technology because I should have gotten some kind of warning message about this.

The simple fix is to order the collection being returned by GetCaseLoads(). I did it like this and it worked:

[RequiresAuthentication()]
public IQueryable<CaseLoad> GetCaseLoads()
{
    // Return all case loads
    return this.Context.CaseLoadSet.OrderBy(caseLoad=>caseLoad.fkUserId);
}

Amazing how much time solving this little problem took.

OTHER TIPS

I had the same problem, I can see from the example given in the RIA Services Overview documentation that they are using LINQ to SQL instead of LINQ to EF - must be something with the difference between the two.

Thanks for posting the workaround, saved me many hours of faffing :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top