.Net中通用分頁頁數(shù)計算方式,分頁的總頁數(shù)算法
總記錄數(shù):totalRecord
每頁最大記錄數(shù):maxResult
算法一:
totalPage = totalRecord % maxResult == 0 ? totalRecord / maxResult : totalRecord / maxResult 1 ;
算法二:(推薦)
totalPage = (totalRecord maxResult -1) / maxResult;
其中 maxResult - 1 就是 totalRecord / maxResult 的最大的余數(shù)
原文鏈接:.Net中通用分頁頁數(shù)計算方式,分頁的總頁數(shù)算法