- 基本功能
- 分页按钮属性效果
- 使用自定义信息区
- Repeater分页
- DataList分页
- Url分页
- Url重写
- Url逆向分页
- n层结构应用
- 使用Xml文件数据源
- 图片浏览示例
- AccessDataSource分页
- SqlDataSource分页
- ObjectDataSource分页
- 自定义数据呈现逻辑
- 使用图片按钮
- 查询结果分页
- 查询结果Url分页
- 克隆属性及事件
- 页索引输入/选择框
- 自定义导航按钮
- 在用户控件中实现分页
- UpdatePanel支持
- 设置当前页按钮位置
- 使用Table布局
- 自定义提交按钮图片
- 从Url中获取每页显示记录数
- 应用CSS样式
- 使用GoToPage方法
- 分页导航元素布局
- 类:
- 属性:
- AlwaysShow
- AlwaysShowFirstLastPageNumber
- BackImageUrl
- ButtonImageAlign
- ButtonImageExtension
- ButtonImageNameExtension
- CloneFrom
- CpiButtonImageNameExtension
- CssClass
- CurrentPageButtonClass
- CurrentPageButtonPosition
- CurrentPageButtonStyle
- CurrentPageButtonTextFormatString
- CurrentPageIndex
- CustomInfoClass
- CustomInfoHTML
- CustomInfoSectionWidth
- CustomInfoStyle
- CustomInfoTextAlign
- DisabledButtonImageNameExtension
- EnableTheming
- EnableUrlRewriting
- EndRecordIndex
- FirstPageText
- FirstPageUrlRewritePattern
- HorizontalAlign
- ImagePath
- InvalidPageIndexErrorMessage
- LastPageText
- LayoutType
- MoreButtonType
- NavigationButtonsPosition
- NavigationButtonType
- NavigationToolTipTextFormatString
- NextPageText
- NumericButtonCount
- NumericButtonTextFormatString
- NumericButtonType
- PageCount
- PageIndexBoxClass
- PageIndexBoxStyle
- PageIndexBoxType
- PageIndexOutOfRangeErrorMessage
- PageSize
- PagesRemain
- PagingButtonLayoutType
- PagingButtonSpacing
- PagingButtonType
- PrevPageText
- RecordCount
- RecordsRemain
- ReverseUrlPageIndex
- ShowBoxThreshold
- ShowCustomInfoSection
- ShowDisabledButtons
- ShowFirstLast
- ShowMoreButtons
- ShowNavigationToolTip
- ShowPageIndex
- ShowPageIndexBox
- ShowPrevNext
- SkinID
- StartRecordIndex
- SubmitButtonClass
- SubmitButtonImageUrl
- SubmitButtonStyle
- SubmitButtonText
- TextAfterPageIndexBox
- TextBeforePageIndexBox
- UrlPageIndexName
- UrlPageSizeName
- UrlPaging
- UrlPagingTarget
- UrlRewritePattern
- 方法:
- 事件:
- 枚举:
- 委托:
AspNetPager 示例 - 基本功能
该示例演示AspNetPager最基本的功能,帮助您认识AspNetPager分页控件及了解它的工作原理。
要使AspNetPager正常运行,只需要设置它的RecordCount属性的值,根据需要编写PageChanged事件处理程序。
点击下面的分页按钮来看实际的运行效果。
Basic.aspx:
<%@ Page Language="C#" AutoEventWireup="true" MetaDescription="该示例演示AspNetPager最基本的功能,帮助您认识AspNetPager分页控件及了解它的工作原理。" Inherits="Basic_Default" MasterPageFile="AspNetPager.master" Title="基本功能" Codebehind="Basic.aspx.cs" %> <asp:Content runat="server" ContentPlaceHolderID="desc"> 要使AspNetPager正常运行,只需要设置它的<strong>RecordCount</strong>属性的值,根据需要编写<strong>PageChanged</strong>事件处理程序。<p>点击下面的分页按钮来看实际的运行效果。</p> </asp:Content> <asp:Content runat="server" ID="content1" ContentPlaceHolderID="main"> <p><asp:Label runat="server" ID="label1" ForeColor="red" EnableViewState="false"></asp:Label> <br /><asp:Label runat="server" ID="label2" ForeColor="red" EnableViewState="false"></asp:Label></p> <asp:CheckBox ID="CheckBox1" runat="server" Text="取消分页事件" />(选中此复选框将只引发PageChanging事件,而不引发PageChanged事件) <p>分页控件实际显示和运行效果:</p> <webdiyer:aspnetpager id="AspNetPager1" runat="server" OnPageChanging="AspNetPager1_PageChanging" onpagechanged="AspNetPager1_PageChanged" CurrentPageButtonPosition="Center" Width="100%" HorizontalAlign="center" AlwaysShowFirstLastPageNumber="true" PagingButtonSpacing="10" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页"></webdiyer:aspnetpager> <p>克隆的分页控件:</p> <div><webdiyer:aspnetpager id="AspNetPager2" runat="server" CloneFrom="AspNetPager1"></webdiyer:aspnetpager></div> </asp:Content>
Basic.aspx.cs:
using System; using System.Web.UI; using Wuqi.Webdiyer; public partial class Basic_Default : Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AspNetPager1.RecordCount = 288; } } protected void AspNetPager1_PageChanging(object src, PageChangingEventArgs e) { if (CheckBox1.Checked) e.Cancel = true; label1.Text = "PageChanging 事件被引发,NewPageIndex 的值是:" + e.NewPageIndex; } protected void AspNetPager1_PageChanged(object src, EventArgs e) { label2.Text = "PageChanged事件被引发,当前页索引是:" + AspNetPager1.CurrentPageIndex; } }