• 分页控件(.ascx文件)


    <script>        
            
    var strURL='<%=strURL%>';
            
    var recordNum=<%=recordNum%>;
            
    var perPageNum=<%=perPageNum%>;
            
    var currentPage=<%=pageIndex%>;
            
    var p=<%=pageIndex%>-1;
            
    var fontcolor='<%=fontcolor%>';
            
            
    if(recordNum%perPageNum==0
            {
                pageNum
    =recordNum/perPageNum;
            }
            
    else
            {
                pageNum
    =(recordNum-recordNum%perPageNum)/perPageNum+1;
            }
            document.write('
    <table border="0" cellpadding="0" cellspacing="3" width="<%=tableWidth%>" align="center" >');
            document.write('
    <form method=post action="'+strURL+'">');        
            document.write('
    <tr style="font-size: 12px;"><td valign="middle">');
            document.write('页次:
    <b>'+currentPage+</b>/<b> '+pageNum+ '</b>页 每页<b>'+perPageNum+</b> 共计:<b>   '+recordNum+</b>条数据</td>');
            document.write('
    <td valign="middle"><div align="right" >分页:');
            
    if(currentPage==1)
            {
                document.write('
    <font face=webdings color="'+fontcolor+'">9</font>');
            }
            
    else
            {
                document.write('
    <a href="'+strURL+'?page=1" title="首页"><font face=webdings>9</font></a>');
            }
            
    if(currentPage>10)
            {
                document.write(' 
    <a href="'+strURL+'?page='+(currentPage-10)+'" title="上十页"><font face=webdings>7</font></a> ');
            }
            document.write('
    <b>');
            
    for (i=p-p%10+1;i<p-p%10+1+10;i++)
            {
                
    if(i==pageNum+1
                    
    break;
                
    if(i==currentPage)
                {
                    document.write(' 
    <font color="'+fontcolor+'">'+i+'</font> ');
                }
                
    else
                {
                    document.write(' 
    <a href="'+strURL+'?page='+i+'">'+i+'</a> ');
                }
            }
            document.write('
    </b>');
            
    if(pageNum-currentPage>=10)
            {
                document.write('
    <a href="'+strURL+'?page='+(currentPage+10)+'" title="下十页"><font face=webdings>8</font></a> ');
            }
            
    if(currentPage!=pageNum)
            {
                document.write('
    <a href="'+strURL+'?page='+pageNum+'" title="尾页"><font face=webdings>:</font></a>  ');
            }
            
    else
            {
                document.write('
    <Font face=webdings color="'+fontcolor+'">:</font>');
            }
             
            document.write(' 转到:
    <input type=text size=3 maxlength=10 value="'+currentPage+'" name=Page><input type=submit value=Go name=submit>');//按钮好像不行,需要完善
            document.write('</div></td></tr>');
            document.write('
    </form></table>');
        
    </script>

            public string strURL="WebForm1.aspx";        
            
    public int recordNum=1000;
            
    public int perPageNum=20;
            
    public int pageIndex;
            
    public string tableWidth="100%";
            
    public string fontcolor="red";

            
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
                pageIndex = System.Convert.ToInt32(Request.QueryString["page"]);
            }

  • 相关阅读:
    织梦调用所有栏目一级二级三级和无限级栏目输出
    织梦添加自定义独立模型缩略图字段官方的一个BUG
    织梦搜索结果增加dede:type、dede:arclist、dede:channelartlist、dede:tag等标签支持
    织梦搜索指定多个栏目的文档
    POJ 1001
    #207 Div.2 B. Flag Day
    sublime Text 2 配置 C++ 编译环境
    1011. 复数类
    1008. 二哥买期货
    MySQL/mariadb知识点——视图管理语句
  • 原文地址:https://www.cnblogs.com/xiaodi/p/123140.html
Copyright © 2020-2023  润新知