AspNetPager paging control

Methods.cs

    1 /* AspNetPager version 7.3.2
    2 Copyright (C) 2003-2010  Webdiyer(http://en.webdiyer.com)
    3 
    4 This file is part of AspNetPager.
    5 
    6 AspNetPager is free software: you can redistribute it and/or modify
    7 it under the terms of the GNU Lesser General Public License as published by
    8 the Free Software Foundation, either version 3 of the License, or
    9 (at your option) any later version.
   10 
   11 AspNetPager is distributed in the hope that it will be useful,
   12 but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 GNU Lesser General Public License for more details.
   15 
   16 You should have received a copy of the GNU Lesser General Public License
   17 along with AspNetPager.  If not, see <http://www.gnu.org/licenses/>.
   18 */
   17 using System;
   18 using System.Collections.Generic;
   19 using System.Text;
   20 
   21 namespace Wuqi.Webdiyer
   22 {
   23     public partial class AspNetPager
   24     {
   25         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="OnPageChanging"]/*'/>
   26         protected virtual void OnPageChanging(PageChangingEventArgs e)
   27         {
   28             //pageChangeEventHandled = true;
   29             PageChangingEventHandler handler = (PageChangingEventHandler)Events[EventPageChanging];
   30             if (handler != null)
   31             {
   32                 handler(this, e);
   33                 if (!e.Cancel || UrlPaging) //there's no way we can obtain the last value of the CurrentPageIndex in UrlPaging mode, so it doesn't make sense to cancel PageChanging event in UrlPaging mode
   34                 {
   35                     CurrentPageIndex = e.NewPageIndex;
   36                     OnPageChanged(EventArgs.Empty);
   37                 }
   38             }
   39             else
   40             {
   41                 CurrentPageIndex = e.NewPageIndex;
   42                 OnPageChanged(EventArgs.Empty);
   43             }
   44             //pageChangeEventHandled = false;
   45         }
   46 
   47         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="OnPageChanged"]/*'/>
   48         protected virtual void OnPageChanged(EventArgs e)
   49         {
   50             EventHandler handler = (EventHandler)Events[EventPageChanged];
   51             if (handler != null)
   52                 handler(this, e);
   53         }
   54 
   55         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="GoToPage"]/*'/>
   56         public virtual void GoToPage(int pageIndex)
   57         {
   58             OnPageChanging(new PageChangingEventArgs(pageIndex));
   59         }
   60     }
   61 }