- 类:
- 属性:
- 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 示例 - 设置RouteValues
本示例演示如何通过RouteValues为UrlPager分页控件设置参数。
Order ID | Order Date | Company Name | Customer ID | Employee Name |
---|---|---|---|---|
10967 | 1998/3/23 | Toms Spezialitäten | TOMSP | Andrew Fuller |
10966 | 1998/3/20 | Chop-suey Chinese | CHOPS | Margaret Peacock |
10965 | 1998/3/20 | Old World Delicatessen | OLDWO | Michael Suyama |
10964 | 1998/3/20 | Spécialités du monde | SPECD | Janet Leverling |
10963 | 1998/3/19 | Furia Bacalhau e Frutos do Mar | FURIB | Anne Dodsworth |
10962 | 1998/3/19 | QUICK-Stop | QUICK | Laura Callahan |
10961 | 1998/3/19 | Queen Cozinha | QUEEN | Laura Callahan |
10960 | 1998/3/19 | HILARION-Abastos | HILAA | Janet Leverling |
10959 | 1998/3/18 | Gourmet Lanchonetes | GOURL | Michael Suyama |
10958 | 1998/3/18 | Océano Atlántico Ltda. | OCEAN | Robert King |
路由定义:
routes.MapPageRoute("UrlPager_RouteValues", "urlpager/demos/{controller}/{action}/{id}", "~/UrlPager/Demos/RouteValues.aspx", false, new RouteValueDictionary { { "id", null }, { "action", "ShowPage" } }, new RouteValueDictionary { { "controller", "RouteValues" } });
RouteValues.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 runat="server" id="pager1" RouteName="UrlPager_RouteValues" CssClass="pull-right" PageIndexParameterName="id" RouteValues="<%$RouteValues:controller=RouteValues,action=ShowPage,city=yanan,author=webdiyer%>" OnPageChanged="PageChanged" PagerItemTemplate=" {0}"></webdiyer:UrlPager>
Default.aspx.cs:
using System; using System.Configuration; using System.Data; using System.Data.SqlClient; namespace Webdiyer.UrlPagerDemo { public partial class RouteValues : 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(); } } }