aspnetpager使用方法

5 篇文章 0 订阅

   样式

  <style type="text/css">
    .paginator { font: 11px Arial, Helvetica, sans-serif;padding:10px 20px 10px 0; margin: 0px;}
    .paginator a {padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none;margin-right:2px}
    .paginator a:visited {padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none;}
    .paginator .cpb {padding: 1px 6px;font-weight: bold; font-size: 13px;border:none}
    .paginator a:hover {color: #fff; background: #ffa501;border-color:#ffa501;text-decoration: none;}
  </style>

      void bind()

{

       string RecordCount = "0", PageCount = "0", CurrentPageIndex = "0";
        IList<TypeManageModel> plist = (new TypeManageDao()).GetAllType(TableName);
        if (plist.Count > 0)
        {
            PagedDataSource pds = new PagedDataSource();
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            AspNetPager1.RecordCount = plist.Count;
            pds.DataSource = plist;
            gv_corplist.DataSource = pds;
            gv_corplist.DataBind();

            RecordCount = AspNetPager1.RecordCount.ToString();
            PageCount = AspNetPager1.PageCount.ToString();
            CurrentPageIndex = AspNetPager1.CurrentPageIndex.ToString();
        }
        else
        {
            gv_corplist.DataBind();
            AspNetPager1.RecordCount = 0;
        }
        //动态设置用户自定义文本内容
        AspNetPager1.CustomInfoText = "记录总数:<font color=/"blue/"><b>" + RecordCount + "</b></font>";
        AspNetPager1.CustomInfoText += " 总页数:<font color=/"blue/"><b>" + PageCount + "</b></font>";
        AspNetPager1.CustomInfoText += " 当前页:<font color=/"red/"><b>" + CurrentPageIndex +     "&nbsp;&nbsp;&nbsp</b></font>";

 }

 

  protected void AspNetPager1_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        this.Bind();
    }

 

 

<div class="technorati" style="vertical-align: top">
                        <webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator" currentpagebuttonclass="cpb"
                            runat="server" AlwaysShow="True" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                            PageSize="15" PrevPageText="上一页" ShowCustomInfoSection="Left" ShowInputBox="Never"
                            OnPageChanged="AspNetPager1_PageChanged" CustomInfoTextAlign="Left" layouttype="Table">
                        </webdiyer:AspNetPager>
                    </div>

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值