样式
<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 + "  </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>