zoukankan      html  css  js  c++  java
  • repeater分页实例

    //        初始化分页类

    PagedDataSource Pgds=new PagedDataSource();
    //        获取数据源

       Pgds.DataSource=CreateDataSource().DefaultView;也可以Pgds.DataSource=List<News>();任何数据集都可
    //        设置允许分页
       Pgds.AllowPaging=true;
    //        每页显示为6行
       Pgds.PageSize=6;
    //        显示总共页数,lblTotalPage为lable控件
       lblTotalPage.Text=Pgds.PageCount.ToString();
    //        当前页
       int CurrentPage;
    //        请求页码为不为null设置当前页,否则为第一页
       if(Request.QueryString["Page"] != null)
       {
        
        CurrentPage = Convert.ToInt32(Request.QueryString["Page"]);
       }

       else
       {

        CurrentPage = 1;
       }
    //   当前页所引为页码-1
       Pgds.CurrentPageIndex = CurrentPage - 1;
    //   显示当前页码
       lblCurrentPage.Text = CurrentPage.ToString();
    //   如果不是第一页,通过参数Page设置上一页为当前页-1,否则不显示连接
       if(!Pgds.IsFirstPage)
       {
        //            Request.CurrentExecutionFilePath为当前请求虚拟路径
        lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurrentPage - 1);
       }
    //        End If
    //   如果不是最后一页,通过参数Page设置下一页为当前页+1,否则不显示连接
       if(!Pgds.IsLastPage)
       {
    //    Request.CurrentExecutionFilePath为当前请求虚拟路径
        lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurrentPage + 1);
       }
    //   模板绑定数据源  
       Repeater1.DataSource = Pgds;
       Repeater1.DataBind();

  • 相关阅读:
    android中的逐帧动画
    在android项目中使用FontAwesome字体
    java中Proxy类初探
    SwipeRefreshLayout基本使用
    【uni-app】condition 启动模式配置,仅开发期间生效
    【uni-app】底部tabbar导航栏右上角添加数字标记
    【uni-app】设置导航条(标题、导航条颜色、加载动画等)
    errno的定义
    S3C6410串口平台设备注册流程分析
    内核线程
  • 原文地址:https://www.cnblogs.com/dachuang/p/2859367.html
Copyright © 2011-2022 走看看