分享

AspNetPager使用方法(精)

 悟静 2012-05-13

AspNetPager使用方法:(自己的一些总结,肯定会有不足的地方,望不吝指教!)

AspNetPager.dll下载的地址 

1、首先引用AspNetPager.dll;

2、在所使用的前台页面加入:<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>,

    指明DLL地址和命名空间;

3、在页面使用aspnetPager控件:(根据情况,自定义下面的属性)

<webdiyer:AspNetPager ID="AspNetPager1" class="quotes" runat="server" CustomInfoHTML="<span class="pageDesc">共有 %RecordCount% 页 %CurrentPageIndex% / %PageCount% 页</span>"
                        FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" Width="95%"
                        CustomInfoStyle="" PagingButtonsClass="PageButton" AlwaysShowFirstLastPageNumber="True"
                        CurrentPageButtonClass="PageButtonCurrent" PagingButtonSpacing="2px" PagingButtonsStyle=""
                        ShowPageIndexBox="Never" CurrentPageButtonStyle="" LayoutType="Table" OnPageChanging="AspNetPager1_PageChanging"
                        ShowCustomInfoSection="Left">
                    </webdiyer:AspNetPager>

 标红的是点击触发事件:

       在.cs后台页面加上此方法:

        protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;//指定显示的页数
        }

4、同时,还要指定以下值: 

      AspNetPager1.PageSize=10;//每页显示多少条记录

      AspNetPager1.RecordCount=100;//总页数

5、因为该控件与数据显示和绑定是独立的,所以可以根据所要显示的页数AspNetPager1.CurrentPageIndex,取得该页数据datatable,然后再使用repeater等控件绑定:

      Repeater1.DataSource = dt;
      Repeater1.DataBind();

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多