-
AspNetPager 一款强大的ASP .NET 分页控件
AspNetPager 一款强大的ASP .NET 分页控件
1.先看看效果:
2.需要引入的dll文件:
AspNetPager.dll 网上可以下载到
下载地址: http://download.csdn.net/detail/yysyangyangyangshan/3625510
3.前台页面代码:
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<tr>
<td>
<webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator" CurrentPageButtonClass="cpb"
Width="99%" PageSize="20" runat="server" AlwaysShow="false" FirstPageText="<<"
LastPageText=">>" NextPageText=">" PrevPageText="<" ShowCustomInfoSection="Left"
ShowInputBox="Never" OnPageChanged="AspNetPager1_PageChanged" CustomInfoTextAlign="Left"
CurrentPageButtonPosition="Beginning" CustomInfoHTML="第 %CurrentPageIndex% 页,共 %PageCount%页,共%RecordCount%条"
ShowPageIndexBox="Always" PageIndexBoxType="DropDownList" TextBeforePageIndexBox="转到第"
TextAfterPageIndexBox="页">
</webdiyer:AspNetPager>
</td>
</tr>
注:AspNetPager 的 PageIndexBoxType 属性还可以配置成输入框的形式
4.后台点击页码触发的方法:
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
searchOrders((string)ViewState[vsKey]);
}
protected void searchOrders(string sSqlWhere)
{
if (sSqlWhere != "" && sSqlWhere != null)
{
this.GridView1.DataSource = (new BLL_tBasis()).GetAllInfos(sSqlWhere, iPageSize, AspNetPager1.CurrentPageIndex, ref iTotalPage, 0, "WYID");
this.GridView1.DataBind();
}
}