ASP.NET MVC 2 Paging Sorting filtering
This may be duplicate question but I could not find one on SO. If so Please point me to the one.
I have seen many examples of Paging and Sorting using IQueryable all fine, but, I dont want to use IQueryable or at least not from outside Repository ( not expose it outside).
I am not using Linq To SQL. My Repository currently returns DTO or ICollection.
I am using JqGrid. I don't want to bring down all data at one time.
As my application is current in development I bring all data and then do Paging, orderBy , SKIP, where etc.. in controller.
what I w开发者_如何学JAVAould Like is to have these operation done at Database Level (where I believe it will be more efficient as size of database increases).
Any suggestions on how I should go about implementing Paging , Sorting and Filtering
Regards,
Mar
If your using your own DAL then I'm not sure what kind of advice somebody could give. 99% of paging is what you do in the data layer. The rest is simply using url variables to send these commands down to the data layer.
Usually Browse/Grid/Collection/Bulk actions are something like this:
public ActionResult Browse( string search, int page, string sortedBy )
{
var dataz = MyDAL.GetResults( search, page, sortedBy );
}
The rest is up to you really.
精彩评论