Keleyipager分頁類,可以于對列表頁進行分頁瀏覽,代碼是從HoverTreeCMS項目中COPY的,感覺很不錯,使用簡單方便,但是功能強大。
在線體驗效果:http://cms.hovertree.com/
源代碼如下:
/* HoverTreeCMS *by 何問起 */namespace HoverTree.HoverTreeFrame.WebUI{ public class KeleyiPager { //代碼是從開源項目HoverTreeCMS中獲取的 //更多信息請參考: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 + "/">第一頁</a> <a href=/"" + absoluteAddress + "?pi=" + (pageIndex - 1).ToString() + "" + moreParams + "/">上一頁</a> " + m_pageIndexInfo; else if (pageIndex == 2) m_pageIndexInfo = "<a href=/"" + absoluteAddress + "?pi=1" + moreParams + "/">第一頁</a> " + m_pageIndexInfo; if (pageIndex == totalPageCount - 1) m_pageIndexInfo = m_pageIndexInfo + " <a href=/"" + absoluteAddress + "?pi=" + totalPageCount.ToString() + moreParams + "/">末頁</a>"; else if (pageIndex < totalPageCount - 1) m_pageIndexInfo = m_pageIndexInfo + " <a href=/"" + absoluteAddress + "?pi=" + (pageIndex + 1).ToString() + moreParams + "/">下一頁</a> " + "<a href=/"" + absoluteAddress + "?pi=" + totalPageCount.ToString() + moreParams + "/">末頁</a> "; return m_pageIndexInfo; } }}
調用的比較簡單方便,使用方法可參考HoverTreeCMS項目,下載地址:http://hovertree.com/down/
轉載自:http://hovertree.com/hvtart/bjae/6w09m1b2.htm
開發技術:http://www.49028c.com/sosoft/p/kaifajishu.html
asp.net開源CMS: http://www.49028c.com/sosoft/p/cms.html
新聞熱點
疑難解答