天天看點

AspNetPager 一款強大的ASP .NET 分頁控件

1.先看看效果:

AspNetPager 一款強大的ASP .NET 分頁控件

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();

                }

            }

轉載于:https://www.cnblogs.com/Resources-blogs/p/6611292.html