Fork me on GitHub

PageChanged Event

Occurs when one of the pager buttons is clicked, but after the UrlPager control handles the paging operation.

C# Syntax:

public event EventHandler PageChanged;


This event occurs everytime page is loaded but not posted back.


The following example demonstrates how to write an event handler for the PageChanged event and binding data in the event handler:
        <webdiyer:UrlPager runat="server" id="pager1" RouteName="UrlPager_Repeater" 
    CssClass="pull-right" PageIndexParameterName="id" PagerItemTemplate="&nbsp;{0}" 
    public partial class Repeater : 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));