AspNetPager的使用


              以下文章只是本人学习过程中的一个总结哈!
              1 首先,我们需要将AspNetPager.dll和AspNetPager.xml这两个文件放到bin目录中。

              2,在索要使用的aspx文件中添加下面这段代码

        <%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
      3,在body里面
        <div style="padding-left:450px; margin-top:20px;">
          <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="true"
             CssClass="Pages" CurrentPageButtonClass="cpb" FirstPageText="首页"
              HorizontalAlign="Center" LastPageText="尾页" NextPageText="后页"
               OnPageChanging="AspNetPager1_PageChanging" PrevPageText="前页">
           </webdiyer:AspNetPager>
        </div>
       其中相应的css
       <style type="text/css">
     .Pages{ color:#999;}
     .Pages a, .pages.cpb{ text-decoration:none; float:left; padding: 0 5px; border:1px solid #ddd; background:#ffff; margin:0 2px; font-size:11px; color:#00                          0;}
     .Pages a:hover { background-color: #E61636; color:#fff;border:1px solid #E61636; text-decoration:none;}
     .Pages .cpb { font-weight: bold; color: #fff; background: #E61636; border:1px solid #E61636;}
        </style>
       4.aspx.cs后台代码
      protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            binddata();
        }


        public void binddata()
        {
            BLLadmin blladmin = new BLLadmin();
            DataSet ds = blladmin.adminlist(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "info");


            GridView1.DataSource = ds;
            GridView1.DataBind();


        }
      在这个过程中可能出现在不到命名空间,原因是UI层中没用引用bin文件夹中的AspNetPager.dll

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值