Esempio n. 1
0
        /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="OnPageChanging"]/*'/>
        protected virtual void OnPageChanging(PageChangingEventArgs e)
        {
            //pageChangeEventHandled = true;
            PageChangingEventHandler handler = (PageChangingEventHandler)Events[EventPageChanging];

            if (handler != null)
            {
                handler(this, e);
                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
                {
                    CurrentPageIndex = e.NewPageIndex;
                    OnPageChanged(EventArgs.Empty);
                }
            }
            else
            {
                CurrentPageIndex = e.NewPageIndex;
                OnPageChanged(EventArgs.Empty);
            }
            //pageChangeEventHandled = false;
        }
Esempio n. 2
0
        /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="RaisePostBackEvent"]/*'/>
        public void RaisePostBackEvent(string args)
        {
            int pageIndex = CurrentPageIndex;

            try
            {
                if (string.IsNullOrEmpty(args))
                {
                    args = inputPageIndex;
                }
                pageIndex = int.Parse(args);
            }
            catch { }
            PageChangingEventArgs pcArgs = new PageChangingEventArgs(pageIndex);

            if (cloneFrom != null)
            {
                cloneFrom.OnPageChanging(pcArgs);
            }
            else
            {
                OnPageChanging(pcArgs);
            }
        }
Esempio n. 3
0
 /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Method[@name="OnLoad"]/*'/>
 protected override void OnLoad(EventArgs e)
 {
     if (UrlPaging)
     {
         currentUrl  = Page.Request.Path;
         queryString = Page.Request.ServerVariables["Query_String"];
         if (!string.IsNullOrEmpty(queryString) && queryString.StartsWith("?")) //mono <v2.8 compatible
         {
             queryString = queryString.TrimStart('?');
         }
         if (!Page.IsPostBack && cloneFrom == null)
         {
             int index;
             int.TryParse(Page.Request.QueryString[UrlPageIndexName], out index);
             if (index <= 0)
             {
                 index = 1;
             }
             else if (ReverseUrlPageIndex)
             {
                 index = PageCount - index + 1;
             }
             PageChangingEventArgs args = new PageChangingEventArgs(index);
             OnPageChanging(args);
         }
     }
     else
     {
         inputPageIndex = Page.Request.Form[UniqueID + "_input"];
     }
     base.OnLoad(e);
     if ((UrlPaging || (!UrlPaging && PageIndexBoxType == PageIndexBoxType.TextBox)) && (ShowPageIndexBox == ShowPageIndexBox.Always || (ShowPageIndexBox == ShowPageIndexBox.Auto && PageCount >= ShowBoxThreshold)))
     {
         HttpContext.Current.Items[scriptRegItemName] = true;
     }
 }