Keleyipager分頁(yè)類,可以于對(duì)列表頁(yè)進(jìn)行分頁(yè)瀏覽,代碼是從HoverTreeCMS項(xiàng)目中COPY的,感覺(jué)很不錯(cuò),使用簡(jiǎn)單方便,但是功能強(qiáng)大。
在線體驗(yàn)效果:http://cms.hovertree.com/
源代碼如下:
/* HoverTreeCMS *by 何問(wèn)起 */namespace HoverTree.HoverTreeFrame.WebUI{ public class KeleyiPager { //代碼是從開(kāi)源項(xiàng)目HoverTreeCMS中獲取的 //更多信息請(qǐng)參考:http://hovertree.com/menu/hovertreecms/ public static string BuildPageIndex(int pageIndex, int totalPageCount) { return BuildPageIndex(pageIndex, totalPageCount, string.Empty); } public static string BuildPageIndex(int pageIndex, int totalPageCount, string moreParams) { return BuildPageIndex(pageIndex, totalPageCount, moreParams, string.Empty); } public static string BuildPageIndex(int pageIndex, int totalPageCount, string moreParams, string absoluteAddress) { if (pageIndex > totalPageCount) pageIndex = totalPageCount; if (pageIndex < 1) pageIndex = 1; string m_pageIndexInfo = pageIndex.ToString() + "/" + totalPageCount.ToString(); if (moreParams != string.Empty) moreParams = "&" + moreParams; if (pageIndex > 2) m_pageIndexInfo = "<a href=/"" + absoluteAddress + "?pi=1" + moreParams + "/">第一頁(yè)</a> <a href=/"" + absoluteAddress + "?pi=" + (pageIndex - 1).ToString() + "" + moreParams + "/">上一頁(yè)</a> " + m_pageIndexInfo; else if (pageIndex == 2) m_pageIndexInfo = "<a href=/"" + absoluteAddress + "?pi=1" + moreParams + "/">第一頁(yè)</a> " + m_pageIndexInfo; if (pageIndex == totalPageCount - 1) m_pageIndexInfo = m_pageIndexInfo + " <a href=/"" + absoluteAddress + "?pi=" + totalPageCount.ToString() + moreParams + "/">末頁(yè)</a>"; else if (pageIndex < totalPageCount - 1) m_pageIndexInfo = m_pageIndexInfo + " <a href=/"" + absoluteAddress + "?pi=" + (pageIndex + 1).ToString() + moreParams + "/">下一頁(yè)</a> " + "<a href=/"" + absoluteAddress + "?pi=" + totalPageCount.ToString() + moreParams + "/">末頁(yè)</a> "; return m_pageIndexInfo; } }}
調(diào)用的比較簡(jiǎn)單方便,使用方法可參考HoverTreeCMS項(xiàng)目,下載地址:http://hovertree.com/down/
轉(zhuǎn)載自:http://hovertree.com/hvtart/bjae/6w09m1b2.htm
開(kāi)發(fā)技術(shù):http://www.survivalescaperooms.com/sosoft/p/kaifajishu.html
asp.net開(kāi)源CMS: http://www.survivalescaperooms.com/sosoft/p/cms.html
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注