AspNetPager paging control

PostBack.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 
   18 using System.Collections.Specialized;
   19 
   20 namespace Wuqi.Webdiyer
   21 {
   22     public partial class AspNetPager
   23     {
   24         #region IPostBackEventHandler Implementation
   25 
   26         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="RaisePostBackEvent"]/*'/>
   27         public void RaisePostBackEvent(string args)
   28         {
   29             int pageIndex = CurrentPageIndex;
   30             try
   31             {
   32                 if (string.IsNullOrEmpty(args))
   33                     args = inputPageIndex;
   34                 pageIndex = int.Parse(args);
   35             }
   36             catch { }
   37             PageChangingEventArgs pcArgs = new PageChangingEventArgs(pageIndex);
   38             if (cloneFrom != null)
   39                 cloneFrom.OnPageChanging(pcArgs);
   40             else
   41                 OnPageChanging(pcArgs);
   42         }
   43 
   44         #endregion
   45 
   46         #region IPostBackDataHandler Implementation
   47 
   48         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="LoadPostData"]/*'/>
   49         public virtual bool LoadPostData(string pkey, NameValueCollection pcol)
   50         {
   51             string str = pcol[UniqueID + "_input"];
   52             if (str != null && str.Trim().Length > 0)
   53             {
   54                 try
   55                 {
   56                     int pindex = int.Parse(str);
   57                     if (pindex > 0 && pindex <= PageCount)
   58                     {
   59                         inputPageIndex = str;
   60                         Page.RegisterRequiresRaiseEvent(this);
   61                     }
   62                 }
   63                 catch { }
   64             }
   65             return false;
   66         }
   67 
   68         /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="RaisePostDataChangedEvent"]/*'/>
   69         public virtual void RaisePostDataChangedEvent() { }
   70 
   71         #endregion
   72     }
   73 }