Those crazy users – they wanted to sort by two fields! What madness is that? So I dig into the source and the original code was sorting with LINQ. Being a sheep, I decided to do the same thing. But how? Through the miracle of the ThenBy operator.
So in this example, I wanted to order by City, then Zip Code. Assuming that my items collection contains objects with City and ZipCode fields:
List<Address> items = DBStuff.GetAddresses(bizID); GridView1.DataSource = items.OrderBy(i => i.City).ThenBy(i => i.ZipCode);
See MSDN for more info.