zoukankan      html  css  js  c++  java
  • 服务器端Ajax异步分页类,基本通用分页类

     public static class PagerHelper
        {
            #region 数字分页类
            /// <summary>
            ///
            /// </summary>
            /// <param name="intCounts"> 总记录数 </param>
            /// <param name="intPageSizes"> 每页显示条数 </param>
            /// <param name="intPageCounts"> 总页数</param>
            /// <param name="intThisPages"> 当前页数 </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 ); //总记录数
                int intPageCount = Convert.ToInt32(intPageCounts ); //总共页数
                int intPageSize = Convert.ToInt32(intPageSizes ); //每页显示
                int intPage = 7 ;  //数字显示
                int intThisPage = Convert.ToInt32(intThisPages ); //当前页数
                int intBeginPage = 0; //开始页数
                int intCrossPage = 0; //变换页数
                int intEndPage = 0; //结束页数
                string strPage = null ; //返回值
    
                intCrossPage = intPage / 2;
                strPage = "共 <font color="#FF0000">" + intCount.ToString() + "</font> 条记录 第 <font color="#FF0000">" + intThisPage.ToString () + "/" + intPageCount.ToString() + "</font> 页 每页 <font color="#FF0000">" + intPageSize.ToString () + "</font> 条     ";
                if (intThisPage > 1)
                {
                    strPage = strPage + "<a href="" + strUrl + "1">首页</a> " ;
                    strPage = strPage + "<a href="" + strUrl + Convert.ToString( intThisPage - 1 ) + "">上一页</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 () + "页">" + i.ToString() + "</a> ";
                        }
                    }
                }
                if (intThisPage < intPageCount)
                {
                    strPage = strPage + "<a href="" + strUrl + Convert.ToString( intThisPage + 1 ) + "">下一页</a> " ;
                    strPage = strPage + "<a href="" + strUrl + intPageCount.ToString() + "">尾页</a> " ;
                }
                return strPage;
            }
            #endregion
        }
    
  • 相关阅读:
    直接初始化和复制初始化
    C++ 内连接与外连接 (转)
    mysql-Innodb事务隔离级别-repeatable read详解(转)
    Linux操作系统多线程信号总结
    Keil MDK 5.14 仿真时System Viewer菜单显示空白和Peripherals菜单无外设寄存器
    转载傅里叶级数和傅里叶变换的理解 https://www.cnblogs.com/h2zZhou/p/8405717.html
    SPI总线的原理与Verilog实现
    SD 模拟sip 读写子程序
    SD卡 模拟SPI总线控制流程
    SD卡spi读写流程
  • 原文地址:https://www.cnblogs.com/alianblank/p/3263718.html
Copyright © 2011-2022 走看看