Johan's Blog

This and that in a developer's life in general
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

Silverlight DataGrid and DataPager Notes

I need to write these things down somewhere...

Brad's excellent tutorials and samples for learning Silverlight + RIA Services: http://blogs.msdn.com/b/brada/archive/2009/10/27/index-for-business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update.aspx

Scott's super blog post about columns and the DataGrid: http://blogs.msdn.com/b/scmorris/archive/2008/03/27/defining-columns-for-a-silverlight-datagrid.aspx (it's getting "old" but still rocks)

To use the DataPager properly with a DomainDataSource, you have to set a sort order. The docs for the DataPager says:

If you use the DataPager in an application with an Entity Framework data store, you must order the data returned by your queries for the DataPager to work correctly. The Entity Framework does not support paging of data without an OrderBy clause.

This can be done with the SortDescriptor property of the DomainDataSource, for example:

<riaControls:DomainDataSource  Name="dds" AutoLoad="True"         
                               QueryName="GetVesselsQuery"                               
                               LoadSize="20" LoadedData="dds_LoadedData">
    <riaControls:DomainDataSource.DomainContext>
        <Services:SomeDomainContext />
    </riaControls:DomainDataSource.DomainContext>
    <riaControls:DomainDataSource.SortDescriptors>
        <riaControls:SortDescriptor PropertyPath="name" Direction="Ascending"/>
    </riaControls:DomainDataSource.SortDescriptors>
</riaControls:DomainDataSource>


Cross-posted from my blog at http://weblogs.asp.net/jdanforth
Published den 5 juli 2010 13:39 by johan
Filed under:
New Comments to this post are disabled
Powered by Community Server, by Telligent Systems