Sorting and filtering data

In most applications, you'll want to give the user the ability to filter and/or sort the data they see on their screen. This recipe will show you one way of doing this: by using custom Query methods on your server project and accepting parameters to control the filtering/sorting you want to use.

Getting ready

This recipe uses the AdventureWorks Lite database—a free database you can download from To follow this recipe, you need to have this database installed on an SQL Server instance you can access from your machine.

We're starting from the solution completed in the previous recipe. You can find a starter solution located in the Chapter09\Sorting_And_Filtering_Starter\ folder ...

Get Silverlight 4 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.