Hi,
I have implemented nerd dinner method of paging- which works great. But I want to be able to dynamically be able to order by certian fields.
How would I go about implementing this. Here is my code?
Controller:
PaginatedList<Classifieds_Ads> pageOfClassifieds = new PaginatedList<Classifieds_Ads>(classifiedsRepositry.GetClassifiedsInCategory(category), paging, 20);
Repository:
return from classifieds in context.Classifieds_Ads.Include("User")
where (from catergory in context.Classifieds_Categories
where catergory.MVC_URL == MVC_Cat
select catergory).Contains(classifieds.Classifieds_Categories)
orderby classifieds.DatePosted descending
select classifieds;
As you can see I have the orderby clause "hard coded" into my repository. I just don't know the code to implement it dynamically?
Anybody have any ideas?
Thanks,