O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to navigate sortable data

In this recipe, we will take a look at all the workings of getting a view in MVC to sort data. The focus will not be so much on the data side of the implementation, as any data source is applicable. Instead, we will look at all of the various places that must be touched to get the plumbing working as required to sort by various fields of data. This recipe will take a look at what is needed to get the routing, view, and controller, as well as a bit of fancy LINQ over a collection of objects.

Getting ready

Having sortable data without data that pages seems incomplete to me. For that reason, we will start with the code from the previous recipe to get us started. This will include the Product and ProductRepository classes. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required