tags:

views:

36

answers:

2

Hi,

Say I am selecting rows from my article table, but I want to dynamically sort by specific columns and sort by des/asc.

Say my method signature looks like:

public List<Article> GetArticles(SortBy sort, SortOrder order)
{

}

Is there a way to do this with linq-to-sql?

+1  A: 

This question might be of some help:

http://stackoverflow.com/questions/41244/dynamic-linq-orderby

John Boker
I'd only add that descending is .OrderByDescending, so you need an if statement for sort order
Russell Steen
A: 

I recently used Dynamite to do this. It worked great for me.

Ronnie Overby