PagerHelper-分页类
生活随笔
收集整理的這篇文章主要介紹了
PagerHelper-分页类
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
2016.01.29 public static class PagerHelper{#region 數(shù)字分頁(yè)類(lèi)/// <summary>/// /// </summary>/// <param name="intCounts">總記錄數(shù)</param>/// <param name="intPageSizes">每頁(yè)顯示條數(shù)</param>/// <param name="intPageCounts">總頁(yè)數(shù)</param>/// <param name="intThisPages">當(dāng)前頁(yè)數(shù)</param>/// <param name="strUrl">Url</param>/// <returns></returns>public static string strPage(int intCounts, int intPageSizes, int intPageCounts, int intThisPages, string strUrl){int intCount = Convert.ToInt32(intCounts); //總記錄數(shù)int intPageCount = Convert.ToInt32(intPageCounts); //總共頁(yè)數(shù)int intPageSize = Convert.ToInt32(intPageSizes); //每頁(yè)顯示int intPage = 7; //數(shù)字顯示int intThisPage = Convert.ToInt32(intThisPages); //當(dāng)前頁(yè)數(shù)int intBeginPage = 0; //開(kāi)始頁(yè)數(shù)int intCrossPage = 0; //變換頁(yè)數(shù)int intEndPage = 0; //結(jié)束頁(yè)數(shù)string strPage = null; //返回值
intCrossPage = intPage / 2;strPage = "共 <font color=\"#FF0000\">" + intCount.ToString() + "</font> 條記錄 第 <font color=\"#FF0000\">" + intThisPage.ToString() + "/" + intPageCount.ToString() + "</font> 頁(yè) 每頁(yè) <font color=\"#FF0000\">" + intPageSize.ToString() + "</font> 條 ";if (intThisPage > 1){strPage = strPage + "<a href=\"" + strUrl + "1\">首頁(yè)</a> ";strPage = strPage + "<a href=\"" + strUrl + Convert.ToString(intThisPage - 1) + "\">上一頁(yè)</a> ";}if (intPageCount > intPage){if (intThisPage > intPageCount - intCrossPage){intBeginPage = intPageCount - intPage + 1;intEndPage = intPageCount;}else{if (intThisPage <= intPage - intCrossPage){intBeginPage = 1;intEndPage = intPage;}else{intBeginPage = intThisPage - intCrossPage;intEndPage = intThisPage + intCrossPage;}}}else{intBeginPage = 1;intEndPage = intPageCount;}if (intCount > 0){for (int i = intBeginPage; i <= intEndPage; i++){if (i == intThisPage){strPage = strPage + " <input type=\"hidden\" id=\"thisPageId\" value=" + i.ToString() + " />" + "<font color=\"#FF0000\">" + i.ToString() + "</font> ";}else{strPage = strPage + " <a href=\"" + strUrl + i.ToString() + "\" title=\"第" + i.ToString() + "頁(yè)\">" + i.ToString() + "</a> ";}}}if (intThisPage < intPageCount){strPage = strPage + "<a href=\"" + strUrl + Convert.ToString(intThisPage + 1) + "\">下一頁(yè)</a> ";strPage = strPage + "<a href=\"" + strUrl + intPageCount.ToString() + "\">尾頁(yè)</a> ";}return strPage;}#endregion} View Code
?
轉(zhuǎn)載于:https://www.cnblogs.com/0to9/p/5170118.html
總結(jié)
以上是生活随笔為你收集整理的PagerHelper-分页类的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 露出的露怎么读?
- 下一篇: Google Chrome v48.0.