- 类:
- 属性:
- AlwaysShowFirstLastPageNumber
- AutoHide
- ContainerTag
- CurrentPageIndex
- CurrentPageNumberFormatString
- CurrentPagerItemTemplate
- DisabledPagerItemTemplate
- EndItemIndex
- FirstPageText
- InheritsRouteValues
- LastPageText
- MorePagerItemTemplate
- MorePageText
- NavigationPagerItemTemplate
- NextPageText
- NumericPagerItemCount
- NumericPagerItemTemplate
- PageIndexParameterName
- PageNumberFormatString
- PagerItemTemplate
- PageSize
- PrevPageText
- ReversePageIndex
- RouteName
- RouteValues
- ShowDisabledPagerItems
- ShowFirstLast
- ShowMorePagerItems
- ShowNumericPagerItems
- ShowPrevNext
- StartItemIndex
- TotalItemCount
- TotalPageCount
- 方法:
- 事件:
UrlPager 示例 - Bootstrap分页样式
本示例演示如何为UrlPager应用Bootstrap分页样式。
Order ID | Order Date | Company Name | Customer ID | Employee Name |
---|---|---|---|---|
11062 | 1998/4/30 | Reggiani Caseifici | REGGC | Margaret Peacock |
11061 | 1998/4/30 | Great Lakes Food Market | GREAL | Margaret Peacock |
11060 | 1998/4/30 | Franchi S.p.A. | FRANS | Andrew Fuller |
11059 | 1998/4/29 | Ricardo Adocicados | RICAR | Andrew Fuller |
11058 | 1998/4/29 | Blauer See Delikatessen | BLAUS | Anne Dodsworth |
路由定义:
routes.MapPageRoute("UrlPager_Bootstrap", "urlpager/demos/{controller}/{pageIndex}", "~/UrlPager/Demos/Bootstrap.aspx", false, new RouteValueDictionary { { "controller", "Bootstrap" }, { "pageIndex", null } }, new RouteValueDictionary { { "controller", "Bootstrap" } });
Bootstrap.aspx:
<%@Register Namespace="Webdiyer.WebControls" Assembly="Webdiyer.UrlPager" TagPrefix="webdiyer"%> <asp:Repeater ID="Repeater1" runat="server"> <headertemplate> <table class="table table-bordered table-hover"> <tr><th>Order ID</th><th>Order Date</th><th>Company Name</th><th>Customer ID</th><th>Employee Name</th></tr> </headertemplate> <itemtemplate> <tr> <td><%#DataBinder.Eval(Container.DataItem,"orderid")%></td> <td><%#DataBinder.Eval(Container.DataItem,"orderdate","{0:d}")%></td> <td><%#DataBinder.Eval(Container.DataItem, "companyname")%></td> <td><%#DataBinder.Eval(Container.DataItem,"customerid")%></td> <td><%#DataBinder.Eval(Container.DataItem,"employeename")%></td> </tr> </itemtemplate> <footertemplate> </table> </footertemplate> </asp:Repeater> <webdiyer:urlpager containertag="Ul" pagesize="5" numericpageritemcount="8" pageritemtemplate="<li>{0}</li>" CssClass="pagination" CurrentPagerItemTemplate="<li class='active'><a href='#'>{0}</a></li>" id="pager1" DisabledPagerItemTemplate="<li class='disabled'><a href='#'>{0}</a></li>" runat="server" RouteName="UrlPager_Bootstrap" InheritsRouteValues="true" OnPageChanged="PageChanged"></webdiyer:UrlPager>
Bootstrap.aspx.cs:
using System; using System.Configuration; using System.Data; using System.Data.SqlClient; namespace Webdiyer.UrlPagerDemo { public partial class Bootstrap : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) pager1.TotalItemCount = (int)SqlHelper.ExecuteScalar(CommandType.StoredProcedure, "P_GetOrderNumber"); } protected void PageChanged(object sender, EventArgs e) { Repeater1.DataSource = SqlHelper.ExecuteReader(CommandType.StoredProcedure, ConfigurationManager.AppSettings["pagedSPName"], new SqlParameter("@startIndex", pager1.StartItemIndex), new SqlParameter("@endIndex", pager1.EndItemIndex)); Repeater1.DataBind(); } } }