zoukankan      html  css  js  c++  java
  • AspNetPager分页控件的使用

            protected void Page_Load(object sender, EventArgs e)
            {
                pager.RecordCount = bm.Count();
                Bind();
            }
            private void Bind()
            {
                PagedDataSource pds = new PagedDataSource();
                pds.AllowPaging = true;
                pds.PageSize = pager.PageSize;
                pds.CurrentPageIndex = pager.CurrentPageIndex - 1;
                pds.DataSource = bm.GetAll().Tables[0].DefaultView;

                DataList1.DataSource = pds;
                DataList1.DataBind();
            }
            protected void pager_PageChanged(object sender, EventArgs e)
            {//分页事件,点击分页会改变CurrentPageIndex的值
                Bind();
            }

    JYOnline分页控件在代码中:
    1.

    DataSet ds = bl.GetByQuery(strWhere, strOrder, AspNetPager1.CurrentPageIndex - 1, AspNetPager1.PageSize);
    AspNetPager1.RecordCount = bllArticle.GetByQueryCount(strWhere);
    2.protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            BindArticle();
        }
    3.web.config中<system.web>下添加节点
        <pages>
          <controls>
            <add assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagPrefix="webdiyer"/>
            <add tagPrefix="EZC" assembly="StudyEZ.Controls" namespace="StudyEZ.Controls"/>
          </controls>
        </pages>

    AspNetPager分页控件的使用:
            protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetAllExams();
            }
        }
            private void GetAllExams()
        {
            PagedDataSource pds = new PagedDataSource();
            DataSet ds=bllpaper.GetAllExam();
            AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.DataSource = ds.Tables[0].DefaultView;
            this.RptExam.DataSource = pds;
            this.RptExam.DataBind();
        }
            protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            GetAllExams();
        }

  • 相关阅读:
    gitlab配置ssh连接
    java 函数编程之Consumer接口的使用
    一枚程序猿的MacBook M1详细体验报告
    【线上问题排查技巧】动态修改LOGGER日志级别
    【线上排查实战】AOP切面执行顺序你真的了解吗
    阿里巴巴Canal常见问题:重复解析/Filter失效/消费落后
    使用Binlog日志恢复误删的MySQL数据实战
    Git实战技巧:恢复被强制push -f失踪的代码
    一次完整的JVM堆外内存泄漏故障排查记录
    Java线上问题排查神器Arthas快速上手与原理浅谈
  • 原文地址:https://www.cnblogs.com/cw_volcano/p/1948065.html
Copyright © 2011-2022 走看看