zoukankan      html  css  js  c++  java
  • asp.net的快捷实用分页类

    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.cnblogs.com/sosoft/p/kaifajishu.html

    ASP.NET开源CMS: http://www.cnblogs.com/sosoft/p/cms.html

  • 相关阅读:
    左孩子右兄弟的字典树
    UVA 1401 Remember the Word
    HDOJ 4770 Lights Against Dudely
    UvaLA 3938 "Ray, Pass me the dishes!"
    UVA
    Codeforces 215A A.Sereja and Coat Rack
    Codeforces 215B B.Sereja and Suffixes
    HDU 4788 Hard Disk Drive
    HDU 2095 find your present (2)
    图的连通性问题—学习笔记
  • 原文地址:https://www.cnblogs.com/sosoft/p/fenye.html
Copyright © 2011-2022 走看看