本文介绍了Asp.net MVC PagedList订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是完全一样的,因为这一项:
 toPagedList()为了从LINQ顺序不同by子句

这个问题在两年前发布的,有没有解决办法呢。我希望有人有答案了。很抱歉,如果不允许这种问题。

编辑:这是我的LINQ语句

 (db.Transactions.OrderByDescending(T => t.ReservationDate))。了ToList();


解决方案

您好我不要有大约ToPagedList想法()方法,但你可以试试这个问题这样

 诠释?页面= 1;
            INT的pageSize = 3;
            INT PAGENUMBER =(第53页1);
            INT numberOfItemsTobeSkipped =(PAGENUMBER-1)* pageSize的;
            VAR链接=(由L中的链接
                        排序依据l.ID降
                         选择L).Skip(numberOfItemsTobeSkipped)。取(pageSize的).T​​oList();

My problem is exactly the same as this one: toPagedList() order differs from the LINQ order by clause

That question was posted two years ago and there's no solution yet. I'm hoping someone have answers now. Sorry if this kind of question is not allowed.

EDIT: Here is my LINQ statement

(db.Transactions.OrderByDescending(t => t.ReservationDate)).ToList();
解决方案

Hi I dont have idea about ToPagedList() method but you can try that problem this way

int? page=1;
            int pageSize = 3; 
            int pageNumber = (page ?? 1);
            int numberOfItemsTobeSkipped = (pageNumber-1)  * pageSize;
            var links =( from l in LINKS
                        orderby l.ID descending
                         select l).Skip(numberOfItemsTobeSkipped).Take(pageSize).ToList();

这篇关于Asp.net MVC PagedList订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 14:16