zoukankan      html  css  js  c++  java
  • gridview自定义分页 aspNetPager用法

    这几天做gridview分页,自带的分页不好用。从网上搜刚开始搜了一个aspNetPager.dll,替换原来的一个dll,自己设置了一些,比如这个控件不显示中文,后来我改成中文的“上一页”、“下一页”、“首页”“尾页”,把ShowPageIndexBox设置为默认true,这样当前页也显示了,还能跳转。

    还设置了 显示自定义区域,默认是不显示了,我改成left,然后再设置下自定义的html,结果就可以显示了,我显示的是 一共有多少行。

    作为这个可有成就感了,虽然只是在别人的基础上修改了下。

    今天我又想实现自定义每页多少行,在网上搜了搜,网上说7.1以上版本才能用,我又下载个7.2版本,真是感谢大家。我按照百度文库中一篇文章说的设置了下,这个文章说的properties.cs文件其实不存在,对应的AspNetPager.cs文件,一步步设置,还添加了一个.xml文件,设置值为true,又改了ShowPageSizeBox,让它永远返回true,哇塞,大功告成。

    下载dll文件,使用反编译工具解码后,双击工程文件,改AspNetPager.cs就可以了,然后重新生成。

    最后在意感谢大家分享资源。

    附上我改后的代码。

    using System;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Drawing;
    using System.IO;
    using System.Security.Permissions;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    namespace Wuqi.Webdiyer
    {
    	[DefaultEvent("PageChanged"), DefaultProperty("PageSize"), Designer(typeof(PagerDesigner)), ToolboxBitmap(typeof(AspNetPager), "AspNetPager.bmp"), ParseChildren(false), PersistChildren(false), ToolboxData("<{0}:AspNetPager runat=server></{0}:AspNetPager>"), ANPDescription("desc_AspNetPager")]
    	[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    	public class AspNetPager : Panel, INamingContainer, IPostBackEventHandler, IPostBackDataHandler
    	{
    		private const string ver = "7.2";
    		private string inputPageIndex;
    		private string currentUrl;
    		private string queryString;
    		private AspNetPager cloneFrom;
    		private static readonly object EventPageChanging = new object();
    		private static readonly object EventPageChanged = new object();
    		private bool pageChangeEventHandled;
    		public event PageChangingEventHandler PageChanging
    		{
    			add
    			{
    				base.Events.AddHandler(AspNetPager.EventPageChanging, value);
    			}
    			remove
    			{
    				base.Events.RemoveHandler(AspNetPager.EventPageChanging, value);
    			}
    		}
    		public event EventHandler PageChanged
    		{
    			add
    			{
    				base.Events.AddHandler(AspNetPager.EventPageChanged, value);
    			}
    			remove
    			{
    				base.Events.RemoveHandler(AspNetPager.EventPageChanged, value);
    			}
    		}
    		[Browsable(true), DefaultValue(false), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowNavigationToolTip")]
    		public bool ShowNavigationToolTip
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowNavigationToolTip;
    				}
    				object obj = this.ViewState["ShowNvToolTip"];
    				return obj != null && (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowNvToolTip"] = value;
    			}
    		}
    		[Browsable(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDefaultValue("def_NavigationToolTipTextFormatString"), ANPDescription("desc_NavigationToolTipTextFormatString")]
    		public string NavigationToolTipTextFormatString
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NavigationToolTipTextFormatString;
    				}
    				object obj = this.ViewState["NvToolTipFormatString"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				if (this.ShowNavigationToolTip)
    				{
    					return SR.GetString("def_NavigationToolTipTextFormatString");
    				}
    				return null;
    			}
    			set
    			{
    				string text = value;
    				if (text.Trim().Length < 1 && text.IndexOf("{0}") < 0)
    				{
    					text = "{0}";
    				}
    				this.ViewState["NvToolTipFormatString"] = text;
    			}
    		}
    		[Browsable(true), DefaultValue(""), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NBTFormatString")]
    		public string NumericButtonTextFormatString
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NumericButtonTextFormatString;
    				}
    				object obj = this.ViewState["NumericButtonTextFormatString"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return string.Empty;
    			}
    			set
    			{
    				this.ViewState["NumericButtonTextFormatString"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(""), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_CPBTextFormatString")]
    		public string CurrentPageButtonTextFormatString
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CurrentPageButtonTextFormatString;
    				}
    				object obj = this.ViewState["CurrentPageButtonTextFormatString"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.NumericButtonTextFormatString;
    			}
    			set
    			{
    				this.ViewState["CurrentPageButtonTextFormatString"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonType.Text), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_PagingButtonType")]
    		public PagingButtonType PagingButtonType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PagingButtonType;
    				}
    				object obj = this.ViewState["PagingButtonType"];
    				if (obj != null)
    				{
    					return (PagingButtonType)obj;
    				}
    				return PagingButtonType.Text;
    			}
    			set
    			{
    				this.ViewState["PagingButtonType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonType.Text), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NumericButtonType")]
    		public PagingButtonType NumericButtonType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NumericButtonType;
    				}
    				object obj = this.ViewState["NumericButtonType"];
    				if (obj != null)
    				{
    					return (PagingButtonType)obj;
    				}
    				return this.PagingButtonType;
    			}
    			set
    			{
    				this.ViewState["NumericButtonType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonLayoutType.None), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_PagingButtonLayoutType")]
    		public PagingButtonLayoutType PagingButtonLayoutType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PagingButtonLayoutType;
    				}
    				object obj = this.ViewState["PagingButtonLayoutType"];
    				if (obj != null)
    				{
    					return (PagingButtonLayoutType)obj;
    				}
    				return PagingButtonLayoutType.None;
    			}
    			set
    			{
    				this.ViewState["PagingButtonLayoutType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonPosition.Fixed), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_CurrentPageButtonPosition")]
    		public PagingButtonPosition CurrentPageButtonPosition
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CurrentPageButtonPosition;
    				}
    				object obj = this.ViewState["CurrentPageButtonPosition"];
    				if (obj != null)
    				{
    					return (PagingButtonPosition)obj;
    				}
    				return PagingButtonPosition.Fixed;
    			}
    			set
    			{
    				this.ViewState["CurrentPageButtonPosition"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonType.Text), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NavigationButtonType")]
    		public PagingButtonType NavigationButtonType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NavigationButtonType;
    				}
    				object obj = this.ViewState["NavigationButtonType"];
    				if (obj != null)
    				{
    					return (PagingButtonType)obj;
    				}
    				return this.PagingButtonType;
    			}
    			set
    			{
    				this.ViewState["NavigationButtonType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(""), TypeConverter(typeof(TargetConverter)), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_UrlPagingTarget")]
    		public string UrlPagingTarget
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.UrlPagingTarget;
    				}
    				return (string)this.ViewState["UrlPagingTarget"];
    			}
    			set
    			{
    				this.ViewState["UrlPagingTarget"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PagingButtonType.Text), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_MoreButtonType")]
    		public PagingButtonType MoreButtonType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.MoreButtonType;
    				}
    				object obj = this.ViewState["MoreButtonType"];
    				if (obj != null)
    				{
    					return (PagingButtonType)obj;
    				}
    				return this.PagingButtonType;
    			}
    			set
    			{
    				this.ViewState["MoreButtonType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(typeof(Unit), "5px"), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_PagingButtonSpacing")]
    		public Unit PagingButtonSpacing
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PagingButtonSpacing;
    				}
    				object obj = this.ViewState["PagingButtonSpacing"];
    				if (obj != null)
    				{
    					return Unit.Parse(obj.ToString());
    				}
    				return Unit.Pixel(5);
    			}
    			set
    			{
    				this.ViewState["PagingButtonSpacing"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowFirstLast")]
    		public bool ShowFirstLast
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowFirstLast;
    				}
    				object obj = this.ViewState["ShowFirstLast"];
    				return obj == null || (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowFirstLast"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowPrevNext")]
    		public bool ShowPrevNext
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowPrevNext;
    				}
    				object obj = this.ViewState["ShowPrevNext"];
    				return obj == null || (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowPrevNext"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowPageIndex")]
    		public bool ShowPageIndex
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowPageIndex;
    				}
    				object obj = this.ViewState["ShowPageIndex"];
    				return obj == null || (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowPageIndex"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("首页"), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_FirstPageText")]
    		public string FirstPageText
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.FirstPageText;
    				}
    				object obj = this.ViewState["FirstPageText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "首页";
    			}
    			set
    			{
    				this.ViewState["FirstPageText"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("上一页"), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_PrevPageText")]
    		public string PrevPageText
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PrevPageText;
    				}
    				object obj = this.ViewState["PrevPageText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "上一页";
    			}
    			set
    			{
    				this.ViewState["PrevPageText"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("下一页"), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NextPageText")]
    		public string NextPageText
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NextPageText;
    				}
    				object obj = this.ViewState["NextPageText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "下一页";
    			}
    			set
    			{
    				this.ViewState["NextPageText"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("尾页"), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_LastPageText")]
    		public string LastPageText
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.LastPageText;
    				}
    				object obj = this.ViewState["LastPageText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "尾页";
    			}
    			set
    			{
    				this.ViewState["LastPageText"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(10), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_NumericButtonCount")]
    		public int NumericButtonCount
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NumericButtonCount;
    				}
    				object obj = this.ViewState["NumericButtonCount"];
    				if (obj != null)
    				{
    					return (int)obj;
    				}
    				return 10;
    			}
    			set
    			{
    				this.ViewState["NumericButtonCount"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowDisabledButtons")]
    		public bool ShowDisabledButtons
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowDisabledButtons;
    				}
    				object obj = this.ViewState["ShowDisabledButtons"];
    				return obj == null || (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowDisabledButtons"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(true), Themeable(true), ANPCategory("cat_Navigation"), ANPDescription("desc_ShowMoreButtons")]
    		public bool ShowMoreButtons
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowMoreButtons;
    				}
    				object obj = this.ViewState["ShowMoreButtons"];
    				return obj == null || (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ShowMoreButtons"] = value;
    			}
    		}
    		[Browsable(false), DefaultValue(false), Obsolete("use CurrentPageButtonPosition instead"), Themeable(false), ANPCategory("Behavior"), ANPDescription("desc_CenterCurrentPageButton")]
    		public bool CenterCurrentPageButton
    		{
    			get
    			{
    				return this.CurrentPageButtonPosition == PagingButtonPosition.Center;
    			}
    			set
    			{
    				if (value)
    				{
    					this.CurrentPageButtonPosition = PagingButtonPosition.Center;
    				}
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), ANPDescription("desc_ImagePath")]
    		public string ImagePath
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ImagePath;
    				}
    				string text = (string)this.ViewState["ImagePath"];
    				if (text != null)
    				{
    					text = base.ResolveUrl(text);
    				}
    				return text;
    			}
    			set
    			{
    				string text = value.Trim().Replace("\", "/");
    				this.ViewState["ImagePath"] = (text.EndsWith("/") ? text : (text + "/"));
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(".gif"), Themeable(true), ANPDescription("desc_ButtonImageExtension")]
    		public string ButtonImageExtension
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ButtonImageExtension;
    				}
    				object obj = this.ViewState["ButtonImageExtension"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return ".gif";
    			}
    			set
    			{
    				string text = value.Trim();
    				this.ViewState["ButtonImageExtension"] = (text.StartsWith(".") ? text : ("." + text));
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_ButtonImageNameExtension")]
    		public string ButtonImageNameExtension
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ButtonImageNameExtension;
    				}
    				object obj = this.ViewState["ButtonImageNameExtension"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["ButtonImageNameExtension"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_CpiButtonImageNameExtension")]
    		public string CpiButtonImageNameExtension
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CpiButtonImageNameExtension;
    				}
    				object obj = this.ViewState["CpiButtonImageNameExtension"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.ButtonImageNameExtension;
    			}
    			set
    			{
    				this.ViewState["CpiButtonImageNameExtension"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_DisabledButtonImageNameExtension")]
    		public string DisabledButtonImageNameExtension
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.DisabledButtonImageNameExtension;
    				}
    				object obj = this.ViewState["DisabledButtonImageNameExtension"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.ButtonImageNameExtension;
    			}
    			set
    			{
    				this.ViewState["DisabledButtonImageNameExtension"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(ImageAlign.NotSet), ANPDescription("desc_ButtonImageAlign")]
    		public ImageAlign ButtonImageAlign
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ButtonImageAlign;
    				}
    				object obj = this.ViewState["ButtonImageAlign"];
    				if (obj != null)
    				{
    					return (ImageAlign)obj;
    				}
    				return ImageAlign.NotSet;
    			}
    			set
    			{
    				if (value != ImageAlign.Right && value != ImageAlign.Left)
    				{
    					this.ViewState["ButtonImageAlign"] = value;
    				}
    			}
    		}
    		[Browsable(true), DefaultValue(false), ANPCategory("cat_Paging"), ANPDescription("desc_UrlPaging")]
    		public bool UrlPaging
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.UrlPaging;
    				}
    				object obj = this.ViewState["UrlPaging"];
    				return obj != null && (bool)obj;
    			}
    			set
    			{
    				this.ViewState["UrlPaging"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("page"), ANPCategory("cat_Paging"), ANPDescription("desc_UrlPageIndexName")]
    		public string UrlPageIndexName
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.UrlPageIndexName;
    				}
    				object obj = this.ViewState["UrlPageIndexName"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "page";
    			}
    			set
    			{
    				this.ViewState["UrlPageIndexName"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(""), ANPCategory("cat_Paging"), ANPDescription("desc_UrlPageSizeName")]
    		public string UrlPageSizeName
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.UrlPageSizeName;
    				}
    				return (string)this.ViewState["UrlPageSizeName"];
    			}
    			set
    			{
    				this.ViewState["UrlPageSizeName"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(false), ANPCategory("cat_Paging"), ANPDescription("desc_ReverseUrlPageIndex")]
    		public bool ReverseUrlPageIndex
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ReverseUrlPageIndex;
    				}
    				object obj = this.ViewState["ReverseUrlPageIndex"];
    				return obj != null && (bool)obj;
    			}
    			set
    			{
    				this.ViewState["ReverseUrlPageIndex"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(1), ANPCategory("cat_Paging"), ANPDescription("desc_CurrentPageIndex")]
    		public int CurrentPageIndex
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CurrentPageIndex;
    				}
    				object obj = this.ViewState["CurrentPageIndex"];
    				int num = (obj == null) ? 1 : ((int)obj);
    				if (num > this.PageCount && this.PageCount > 0)
    				{
    					return this.PageCount;
    				}
    				if (num < 1)
    				{
    					return 1;
    				}
    				return num;
    			}
    			set
    			{
    				int num = value;
    				if (num < 1)
    				{
    					num = 1;
    				}
    				this.ViewState["CurrentPageIndex"] = num;
    				if (!this.pageChangeEventHandled)
    				{
    					this.OnPageChanging(new PageChangingEventArgs(num));
    				}
    			}
    		}
    		[Browsable(false), Category("Data"), DefaultValue(0), ANPDescription("desc_RecordCount")]
    		public int RecordCount
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.RecordCount;
    				}
    				object obj = this.ViewState["Recordcount"];
    				if (obj != null)
    				{
    					return (int)obj;
    				}
    				return 0;
    			}
    			set
    			{
    				this.ViewState["Recordcount"] = value;
    			}
    		}
    		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		public int PagesRemain
    		{
    			get
    			{
    				return this.PageCount - this.CurrentPageIndex;
    			}
    		}
    		[Browsable(true), DefaultValue(10), ANPCategory("cat_Paging"), ANPDescription("desc_PageSize")]
    		public int PageSize
    		{
    			get
    			{
                    //int num;
                    //if (!string.IsNullOrEmpty(this.UrlPageSizeName) && !base.DesignMode && int.TryParse(this.Page.Request.QueryString[this.UrlPageSizeName], out num) && num > 0)
                    //{
                    //    return num;
                    //}
                    //检测使用UrlPageSizeName参数
                    if (!string.IsNullOrEmpty(UrlPageSizeName) && !DesignMode)
                    {
                        int pageSize;
                        if (int.TryParse(Page.Request.QueryString[UrlPageSizeName], out pageSize))
                        {
                            if (pageSize > 0)
                                return pageSize;
                        }
                    }
                    //End
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PageSize;
    				}
    				object obj = this.ViewState["PageSize"];
    				if (obj != null)
    				{
    					return (int)obj;
    				}
    				return 10;
    			}
    			set
    			{
    				this.ViewState["PageSize"] = value;
    			}
    		}
            /// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ShowPageSizeBox"]/*'/>
            [Browsable(true), ANPCategory("cat_PageSizeBox"), DefaultValue(null), ANPDescription("desc_ShowPageSizeBox")]
            public bool ShowPageSizeBox
            {
                get
                {
                    if (null != cloneFrom)
                        return cloneFrom.ShowPageSizeBox;
                    object obj = ViewState["ShowPageSizeBox"];
    
                    //此处为当未设置ShowPageSizeBox属性时,取web.config中AppSettings的ShowPageSizeBox
                    if (obj == null)
                    {
                        obj = System.Configuration.ConfigurationManager.AppSettings["ShowPageSizeBox"];
                    }
                    return true;
                   // return (obj == null) ? false : bool.Parse(obj.ToString());
                }
                set { ViewState["ShowPageSizeBox"] = value; }
            }
    		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		public int RecordsRemain
    		{
    			get
    			{
    				if (this.CurrentPageIndex < this.PageCount)
    				{
    					return this.RecordCount - this.CurrentPageIndex * this.PageSize;
    				}
    				return 0;
    			}
    		}
    		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		public int StartRecordIndex
    		{
    			get
    			{
    				return (this.CurrentPageIndex - 1) * this.PageSize + 1;
    			}
    		}
    		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		public int EndRecordIndex
    		{
    			get
    			{
    				return this.RecordCount - this.RecordsRemain;
    			}
    		}
    		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    		public int PageCount
    		{
    			get
    			{
    				if (this.RecordCount == 0)
    				{
    					return 1;
    				}
    				return (int)Math.Ceiling((double)this.RecordCount / (double)this.PageSize);
    			}
    		}
    		[Browsable(true), DefaultValue(ShowPageIndexBox.Always), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_ShowPageIndexBox")]
    		public ShowPageIndexBox ShowPageIndexBox
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowPageIndexBox;
    				}
    				object obj = this.ViewState["ShowPageIndexBox"];
    				if (obj != null)
    				{
    					return (ShowPageIndexBox)obj;
    				}
    				return ShowPageIndexBox.Auto;
    			}
    			set
    			{
    				this.ViewState["ShowPageIndexBox"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(PageIndexBoxType.TextBox), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_PageIndexBoxType")]
    		public PageIndexBoxType PageIndexBoxType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PageIndexBoxType;
    				}
    				object obj = this.ViewState["PageIndexBoxType"];
    				if (obj != null)
    				{
    					return (PageIndexBoxType)obj;
    				}
    				return PageIndexBoxType.TextBox;
    			}
    			set
    			{
    				this.ViewState["PageIndexBoxType"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(null), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_PageIndexBoxClasss")]
    		public string PageIndexBoxClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PageIndexBoxClass;
    				}
    				object obj = this.ViewState["PageIndexBoxClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				if (value.Trim().Length > 0)
    				{
    					this.ViewState["PageIndexBoxClass"] = value;
    				}
    			}
    		}
    		[Browsable(true), DefaultValue(null), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_PageIndexBoxStyle")]
    		public string PageIndexBoxStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PageIndexBoxStyle;
    				}
    				object obj = this.ViewState["PageIndexBoxStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				if (value.Trim().Length > 0)
    				{
    					this.ViewState["PageIndexBoxStyle"] = value;
    				}
    			}
    		}
    		[Browsable(true), DefaultValue(null), Themeable(true), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_TextBeforePageIndexBox")]
    		public string TextBeforePageIndexBox
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.TextBeforePageIndexBox;
    				}
    				object obj = this.ViewState["TextBeforePageIndexBox"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["TextBeforePageIndexBox"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(null), Themeable(true), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_TextAfterPageIndexBox")]
    		public string TextAfterPageIndexBox
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.TextAfterPageIndexBox;
    				}
    				object obj = this.ViewState["TextAfterPageIndexBox"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["TextAfterPageIndexBox"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue("go"), Themeable(true), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_SubmitButtonText")]
    		public string SubmitButtonText
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.SubmitButtonText;
    				}
    				object obj = this.ViewState["SubmitButtonText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return "go";
    			}
    			set
    			{
    				if (value == null)
    				{
    					value = "go";
    				}
    				this.ViewState["SubmitButtonText"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(null), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_SubmitButtonClass")]
    		public string SubmitButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.SubmitButtonClass;
    				}
    				return (string)this.ViewState["SubmitButtonClass"];
    			}
    			set
    			{
    				this.ViewState["SubmitButtonClass"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(null), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_SubmitButtonStyle")]
    		public string SubmitButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.SubmitButtonStyle;
    				}
    				return (string)this.ViewState["SubmitButtonStyle"];
    			}
    			set
    			{
    				this.ViewState["SubmitButtonStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(""), ANPDescription("desc_SubmitButtonImageUrl")]
    		public string SubmitButtonImageUrl
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.SubmitButtonImageUrl;
    				}
    				return (string)this.ViewState["SubmitButtonImageUrl"];
    			}
    			set
    			{
    				this.ViewState["SubmitButtonImageUrl"] = value;
    			}
    		}
    		[Browsable(true), DefaultValue(30), Themeable(true), ANPCategory("cat_PageIndexBox"), ANPDescription("desc_ShowBoxThreshold")]
    		public int ShowBoxThreshold
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowBoxThreshold;
    				}
    				object obj = this.ViewState["ShowBoxThreshold"];
    				if (obj != null)
    				{
    					return (int)obj;
    				}
    				return 30;
    			}
    			set
    			{
    				this.ViewState["ShowBoxThreshold"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(ShowCustomInfoSection.Left), Themeable(true), ANPDescription("desc_ShowCustomInfoSection")]
    		public ShowCustomInfoSection ShowCustomInfoSection
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.ShowCustomInfoSection;
    				}
    				object obj = this.ViewState["ShowCustomInfoSection"];
    				if (obj != null)
    				{
    					return (ShowCustomInfoSection)obj;
    				}
    				return ShowCustomInfoSection.Left;
    			}
    			set
    			{
    				this.ViewState["ShowCustomInfoSection"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(HorizontalAlign.NotSet), ANPDescription("desc_CustomInfoTextAlign")]
    		public HorizontalAlign CustomInfoTextAlign
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CustomInfoTextAlign;
    				}
    				object obj = this.ViewState["CustomInfoTextAlign"];
    				if (obj != null)
    				{
    					return (HorizontalAlign)obj;
    				}
    				return HorizontalAlign.NotSet;
    			}
    			set
    			{
    				this.ViewState["CustomInfoTextAlign"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(typeof(Unit), "40%"), ANPDescription("desc_CustomInfoSectionWidth")]
    		public Unit CustomInfoSectionWidth
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CustomInfoSectionWidth;
    				}
    				object obj = this.ViewState["CustomInfoSectionWidth"];
    				if (obj != null)
    				{
    					return (Unit)obj;
    				}
    				return Unit.Percentage(40.0);
    			}
    			set
    			{
    				this.ViewState["CustomInfoSectionWidth"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), ANPDescription("desc_CustomInfoClass")]
    		public string CustomInfoClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CustomInfoClass;
    				}
    				object obj = this.ViewState["CustomInfoClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.CssClass;
    			}
    			set
    			{
    				this.ViewState["CustomInfoClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), ANPDescription("desc_CustomInfoStyle")]
    		public string CustomInfoStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CustomInfoStyle;
    				}
    				object obj = this.ViewState["CustomInfoStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return base.Style.Value;
    			}
    			set
    			{
    				this.ViewState["CustomInfoStyle"] = value;
    			}
    		}
            [Browsable(true), Category("Appearance"), DefaultValue("共<font color='#ff0000'>%RecordCount%</font>行"), Themeable(true), ANPDescription("desc_CustomInfoHTML")]
    		public string CustomInfoHTML
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CustomInfoHTML;
    				}
    				object obj = this.ViewState["CustomInfoText"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
                    return "共<font color='#ff0000'>%RecordCount%</font>行";
    			}
    			set
    			{
    				this.ViewState["CustomInfoText"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_CurrentPageButtonStyle")]
    		public string CurrentPageButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CurrentPageButtonStyle;
    				}
    				object obj = this.ViewState["CPBStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["CPBStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_CurrentPageButtonClass")]
    		public string CurrentPageButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.CurrentPageButtonClass;
    				}
    				object obj = this.ViewState["CPBClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["CPBClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_PagingButtonClass")]
    		public string PagingButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PagingButtonClass;
    				}
    				object obj = this.ViewState["PagingButtonClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["PagingButtonClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_PagingButtonStyle")]
    		public string PagingButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PagingButtonStyle;
    				}
    				object obj = this.ViewState["PagingButtonStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["PagingButtonStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_FirstLastButtonClass")]
    		public string FirstLastButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.FirstLastButtonClass;
    				}
    				object obj = this.ViewState["FirstLastButtonClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonClass;
    			}
    			set
    			{
    				this.ViewState["FirstLastButtonClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_FirstLastButtonStyle")]
    		public string FirstLastButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.FirstLastButtonStyle;
    				}
    				object obj = this.ViewState["FirstLastButtonStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonStyle;
    			}
    			set
    			{
    				this.ViewState["FirstLastButtonStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_NextPrevButtonClass")]
    		public string NextPrevButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NextPrevButtonClass;
    				}
    				object obj = this.ViewState["NextPrevButtonClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonClass;
    			}
    			set
    			{
    				this.ViewState["NextPrevButtonClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_NextPrevButtonStyle")]
    		public string NextPrevButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.NextPrevButtonStyle;
    				}
    				object obj = this.ViewState["NextPrevButtonStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonStyle;
    			}
    			set
    			{
    				this.ViewState["NextPrevButtonStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_MoreButtonClass")]
    		public string MoreButtonClass
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.MoreButtonClass;
    				}
    				object obj = this.ViewState["MoreButtonClass"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonClass;
    			}
    			set
    			{
    				this.ViewState["MoreButtonClass"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(null), Themeable(true), ANPDescription("desc_MoreButtonStyle")]
    		public string MoreButtonStyle
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.MoreButtonStyle;
    				}
    				object obj = this.ViewState["MoreButtonStyle"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				return this.PagingButtonStyle;
    			}
    			set
    			{
    				this.ViewState["MoreButtonStyle"] = value;
    			}
    		}
    		[Browsable(true), Category("Behavior"), DefaultValue(false), TypeConverter(typeof(AspNetPagerIDConverter)), Themeable(false), ANPDescription("desc_CloneFrom")]
    		public string CloneFrom
    		{
    			get
    			{
    				return (string)this.ViewState["CloneFrom"];
    			}
    			set
    			{
    				if (value != null && string.Empty == value.Trim())
    				{
    					throw new ArgumentNullException("CloneFrom", "The Value of property CloneFrom can not be empty string!");
    				}
    				if (this.ID.Equals(value, StringComparison.OrdinalIgnoreCase))
    				{
    					throw new ArgumentException("The property value of CloneFrom can not be set to control itself!", "CloneFrom");
    				}
    				this.ViewState["CloneFrom"] = value;
    			}
    		}
    		public override bool EnableTheming
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.EnableTheming;
    				}
    				return base.EnableTheming;
    			}
    			set
    			{
    				base.EnableTheming = value;
    			}
    		}
    		public override string SkinID
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.SkinID;
    				}
    				return base.SkinID;
    			}
    			set
    			{
    				base.SkinID = value;
    			}
    		}
    		[Browsable(true), Category("Behavior"), DefaultValue(false), Themeable(true), ANPDescription("desc_EnableUrlWriting")]
    		public bool EnableUrlRewriting
    		{
    			get
    			{
    				object obj = this.ViewState["UrlRewriting"];
    				if (obj == null)
    				{
    					return this.cloneFrom != null && this.cloneFrom.EnableUrlRewriting;
    				}
    				return (bool)obj;
    			}
    			set
    			{
    				this.ViewState["UrlRewriting"] = value;
    				if (value)
    				{
    					this.UrlPaging = true;
    				}
    			}
    		}
    		[Browsable(true), Category("Behavior"), DefaultValue(null), Themeable(true), ANPDescription("desc_UrlRewritePattern")]
    		public string UrlRewritePattern
    		{
    			get
    			{
    				object obj = this.ViewState["URPattern"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.UrlRewritePattern;
    				}
    				if (this.EnableUrlRewriting && !base.DesignMode)
    				{
    					string filePath = this.Page.Request.FilePath;
    					return Path.GetFileNameWithoutExtension(filePath) + "_{0}" + Path.GetExtension(filePath);
    				}
    				return null;
    			}
    			set
    			{
    				this.ViewState["URPattern"] = value;
    			}
    		}
    		[Browsable(true), Category("Behavior"), DefaultValue(false), Themeable(true), ANPDescription("desc_AlwaysShow")]
    		public bool AlwaysShow
    		{
    			get
    			{
    				object obj = this.ViewState["AlwaysShow"];
    				if (obj == null)
    				{
    					return this.cloneFrom != null && this.cloneFrom.AlwaysShow;
    				}
    				return (bool)obj;
    			}
    			set
    			{
    				this.ViewState["AlwaysShow"] = value;
    			}
    		}
    		public override bool Wrap
    		{
    			get
    			{
    				return base.Wrap;
    			}
    			set
    			{
    				base.Wrap = false;
    			}
    		}
    		[Browsable(true), Category("Data"), Themeable(true), ANPDefaultValue("def_PIOutOfRangerMsg"), ANPDescription("desc_PIOutOfRangeMsg")]
    		public string PageIndexOutOfRangeErrorMessage
    		{
    			get
    			{
    				object obj = this.ViewState["PIOutOfRangeErrorMsg"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.PageIndexOutOfRangeErrorMessage;
    				}
    				return SR.GetString("def_PIOutOfRangerMsg");
    			}
    			set
    			{
    				this.ViewState["PIOutOfRangeErrorMsg"] = value;
    			}
    		}
    		[Browsable(true), Category("Data"), Themeable(true), ANPDefaultValue("def_InvalidPIErrorMsg"), ANPDescription("desc_InvalidPIErrorMsg")]
    		public string InvalidPageIndexErrorMessage
    		{
    			get
    			{
    				object obj = this.ViewState["InvalidPIErrorMsg"];
    				if (obj != null)
    				{
    					return (string)obj;
    				}
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.InvalidPageIndexErrorMessage;
    				}
    				return SR.GetString("def_InvalidPIErrorMsg");
    			}
    			set
    			{
    				this.ViewState["InvalidPIErrorMsg"] = value;
    			}
    		}
    		[Browsable(true), Category("Appearance"), DefaultValue(LayoutType.Div), Themeable(true), ANPDescription("desc_LayoutType")]
    		public LayoutType LayoutType
    		{
    			get
    			{
    				if (this.cloneFrom != null)
    				{
    					return this.cloneFrom.LayoutType;
    				}
    				object obj = this.ViewState["LayoutType"];
    				if (obj != null)
    				{
    					return (LayoutType)obj;
    				}
    				return LayoutType.Div;
    			}
    			set
    			{
    				this.ViewState["LayoutType"] = value;
    			}
    		}
    		protected override void OnInit(EventArgs e)
    		{
    			base.OnInit(e);
    			if (this.CloneFrom != null && string.Empty != this.CloneFrom.Trim())
    			{
    				AspNetPager aspNetPager = this.Parent.FindControl(this.CloneFrom) as AspNetPager;
    				if (aspNetPager == null)
    				{
    					string text = SR.GetString("clonefromexeption") ?? "The control " %controlID% " does not exist or is not of type Wuqi.Webdiyer.AspNetPager!";
    					throw new ArgumentException(text.Replace("%controlID%", this.CloneFrom), "CloneFrom");
    				}
    				if (aspNetPager.cloneFrom != null && this == aspNetPager.cloneFrom)
    				{
    					string message = SR.GetString("recusiveclonefrom") ?? "Invalid value for the CloneFrom property, AspNetPager controls can not to be cloned recursively!";
    					throw new ArgumentException(message, "CloneFrom");
    				}
    				this.cloneFrom = aspNetPager;
    				this.CssClass = this.cloneFrom.CssClass;
    				this.Width = this.cloneFrom.Width;
    				base.Style.Value = this.cloneFrom.Style.Value;
    				this.Height = this.cloneFrom.Height;
    				this.HorizontalAlign = this.cloneFrom.HorizontalAlign;
    				this.BackColor = this.cloneFrom.BackColor;
    				this.BackImageUrl = this.cloneFrom.BackImageUrl;
    				this.BorderColor = this.cloneFrom.BorderColor;
    				this.BorderStyle = this.cloneFrom.BorderStyle;
    				this.BorderWidth = this.cloneFrom.BorderWidth;
    				this.Font.CopyFrom(this.cloneFrom.Font);
    				this.ForeColor = this.cloneFrom.ForeColor;
    				this.EnableViewState = this.cloneFrom.EnableViewState;
    				this.Enabled = this.cloneFrom.Enabled;
    			}
    		}
    		protected override void OnLoad(EventArgs e)
    		{
    			if (this.UrlPaging)
    			{
    				this.currentUrl = this.Page.Request.Path;
    				this.queryString = this.Page.Request.ServerVariables["Query_String"];
    				if (!this.Page.IsPostBack && this.cloneFrom == null)
    				{
    					int num;
    					int.TryParse(this.Page.Request.QueryString[this.UrlPageIndexName], out num);
    					if (num <= 0)
    					{
    						num = 1;
    					}
    					else
    					{
    						if (this.ReverseUrlPageIndex)
    						{
    							num = this.PageCount - num + 1;
    						}
    					}
    					PageChangingEventArgs e2 = new PageChangingEventArgs(num);
    					this.OnPageChanging(e2);
    				}
    			}
    			else
    			{
    				this.inputPageIndex = this.Page.Request.Form[this.UniqueID + "_input"];
                    //此处为新增代码
                    if (null != Page.Request.Form[UniqueID + "_ChangePageSize"])
                    {
                        this.PageSize = int.Parse(Page.Request.Form[UniqueID + "_ChangePageSize"]);
                    }
                    //新增代码结束
    			}
    			base.OnLoad(e);
    		}
    		protected override void OnPreRender(EventArgs e)
    		{
    			if (this.PageCount > 1 && (this.ShowPageIndexBox == ShowPageIndexBox.Always || (this.ShowPageIndexBox == ShowPageIndexBox.Auto && this.PageCount >= this.ShowBoxThreshold)))
    			{
    				StringBuilder stringBuilder = new StringBuilder("<script language="Javascript"><!--
    ");
    				if (this.UrlPaging)
    				{
    					stringBuilder.Append("function ANP_goToPage(boxEl){if(boxEl!=null){var pi;if(boxEl.tagName=="SELECT")");
    					stringBuilder.Append("{pi=boxEl.options[boxEl.selectedIndex].value;}else{pi=boxEl.value;}");
    					if (string.IsNullOrEmpty(this.UrlPagingTarget))
    					{
    						stringBuilder.Append("location.href="").Append(this.GetHrefString(-1)).Append(""");
    					}
    					else
    					{
    						stringBuilder.Append("window.open("").Append(this.GetHrefString(-1)).Append("","").Append(this.UrlPagingTarget).Append("")");
    					}
    					stringBuilder.Append(";}}
    ");
    				}
    				if (this.PageIndexBoxType == PageIndexBoxType.TextBox)
    				{
    					string text = SR.GetString("checkinputscript");
    					if (text != null)
    					{
    						text = text.Replace("%PageIndexOutOfRangeErrorMessage%", this.PageIndexOutOfRangeErrorMessage);
    						text = text.Replace("%InvalidPageIndexErrorMessage%", this.InvalidPageIndexErrorMessage);
    					}
    					stringBuilder.Append(text).Append("
    ");
    					string @string = SR.GetString("keydownscript");
    					stringBuilder.Append(@string);
    				}
    				stringBuilder.Append("
    --></script>");
    				Type type = base.GetType();
    				ClientScriptManager clientScript = this.Page.ClientScript;
    				if (!clientScript.IsClientScriptBlockRegistered(type, "anp_script"))
    				{
    					clientScript.RegisterClientScriptBlock(type, "anp_script", stringBuilder.ToString());
    				}
    			}
    			base.OnPreRender(e);
    		}
    		protected override void AddAttributesToRender(HtmlTextWriter writer)
    		{
    			if (this.Page != null && (!this.UrlPaging || (this.UrlPaging && this.ShowPageIndexBox != ShowPageIndexBox.Never)))
    			{
    				this.Page.VerifyRenderingInServerForm(this);
    			}
    			base.AddAttributesToRender(writer);
    		}
    		public override void RenderBeginTag(HtmlTextWriter writer)
    		{
    			bool flag = this.PageCount > 1 || (this.PageCount <= 1 && this.AlwaysShow);
    			writer.WriteLine();
    			writer.Write("<!-- ");
    			writer.Write("AspNetPager V7.2 for VS2005 & VS2008  Copyright:2003-2008 Webdiyer (www.webdiyer.com)");
    			writer.WriteLine(" -->");
    			if (!flag)
    			{
    				writer.Write("<!--");
    				writer.Write(SR.GetString("autohideinfo"));
    				writer.Write("-->");
    				return;
    			}
    			base.RenderBeginTag(writer);
    		}
    		public override void RenderEndTag(HtmlTextWriter writer)
    		{
    			if (this.PageCount > 1 || (this.PageCount <= 1 && this.AlwaysShow))
    			{
    				base.RenderEndTag(writer);
    			}
    			writer.WriteLine();
    			writer.Write("<!-- ");
    			writer.Write("AspNetPager V7.2 for VS2005 & VS2008 End");
    			writer.WriteLine(" -->");
    			writer.WriteLine();
    		}
    		protected override void RenderContents(HtmlTextWriter writer)
    		{
    			if (this.PageCount <= 1 && !this.AlwaysShow)
    			{
    				return;
    			}
    			writer.Indent = 0;
    			if (this.ShowCustomInfoSection != ShowCustomInfoSection.Never)
    			{
    				if (this.LayoutType == LayoutType.Table)
    				{
    					writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
    					writer.AddAttribute(HtmlTextWriterAttribute.Style, base.Style.Value);
    					if (this.Height != Unit.Empty)
    					{
    						writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
    					}
    					writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    					writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
    					writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
    					writer.RenderBeginTag(HtmlTextWriterTag.Table);
    					writer.RenderBeginTag(HtmlTextWriterTag.Tr);
    				}
    				if (this.ShowCustomInfoSection == ShowCustomInfoSection.Left)
    				{
    					this.RenderCustomInfoSection(writer);
    					this.RenderNavigationSection(writer);
    				}
    				else
    				{
    					this.RenderNavigationSection(writer);
    					this.RenderCustomInfoSection(writer);
    				}
    				if (this.LayoutType == LayoutType.Table)
    				{
    					writer.RenderEndTag();
    					writer.RenderEndTag();
    					return;
    				}
    			}
    			else
    			{
    				this.RenderPagingElements(writer);
    			}
    		}
    		private static void addMoreListItem(HtmlTextWriter writer, int pageIndex)
    		{
    			writer.Write("<option value="");
    			writer.Write(pageIndex);
    			writer.Write("">......</option>");
    		}
    		private void listPageIndices(HtmlTextWriter writer, int startIndex, int endIndex)
    		{
    			for (int i = startIndex; i <= endIndex; i++)
    			{
    				writer.Write("<option value="");
    				writer.Write(i);
    				writer.Write(""");
    				if (i == this.CurrentPageIndex)
    				{
    					writer.Write(" selected="true"");
    				}
    				writer.Write(">");
    				writer.Write(i);
    				writer.Write("</option>");
    			}
    		}
    		private void RenderCustomInfoSection(HtmlTextWriter writer)
    		{
    			if (this.Height != Unit.Empty)
    			{
    				writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
    			}
    			string value = this.CustomInfoSectionWidth.ToString();
    			if (this.CustomInfoClass != null && this.CustomInfoClass.Trim().Length > 0)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CustomInfoClass);
    			}
    			if (this.CustomInfoStyle != null && this.CustomInfoStyle.Trim().Length > 0)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Style, this.CustomInfoStyle);
    			}
    			writer.AddStyleAttribute(HtmlTextWriterStyle.Width, value);
    			if (this.CustomInfoTextAlign != HorizontalAlign.NotSet)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Align, this.CustomInfoTextAlign.ToString().ToLower());
    			}
    			if (this.LayoutType == LayoutType.Div)
    			{
    				writer.AddStyleAttribute("float", "left");
    				writer.RenderBeginTag(HtmlTextWriterTag.Div);
    			}
    			else
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Valign, "bottom");
    				writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "true");
    				writer.RenderBeginTag(HtmlTextWriterTag.Td);
    			}
    			writer.Write(this.GetCustomInfoHTML(this.CustomInfoHTML));
    			writer.RenderEndTag();
    		}
    		private void RenderNavigationSection(HtmlTextWriter writer)
    		{
    			if (this.CustomInfoSectionWidth.Type == UnitType.Percentage)
    			{
    				writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Unit.Percentage(100.0 - this.CustomInfoSectionWidth.Value).ToString());
    			}
    			if (this.HorizontalAlign != HorizontalAlign.NotSet)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Align, this.HorizontalAlign.ToString().ToLower());
    			}
    			if (!string.IsNullOrEmpty(this.CssClass))
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
    			}
    			if (this.LayoutType == LayoutType.Div)
    			{
    				writer.AddStyleAttribute("float", "left");
    				writer.RenderBeginTag(HtmlTextWriterTag.Div);
    			}
    			else
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Valign, "bottom");
    				writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "true");
    				writer.RenderBeginTag(HtmlTextWriterTag.Td);
    			}
    			this.RenderPagingElements(writer);
    			writer.RenderEndTag();
    		}
    		private void RenderPagingElements(HtmlTextWriter writer)
    		{
    			int num = (this.CurrentPageIndex - 1) / this.NumericButtonCount * this.NumericButtonCount;
    			if (this.PageCount > this.NumericButtonCount && this.CurrentPageButtonPosition != PagingButtonPosition.Fixed)
    			{
    				switch (this.CurrentPageButtonPosition)
    				{
    				case PagingButtonPosition.Beginning:
    					num = this.CurrentPageIndex - 1;
    					if (num + this.NumericButtonCount > this.PageCount)
    					{
    						num = this.PageCount - this.NumericButtonCount;
    					}
    					break;
    				case PagingButtonPosition.End:
    					if (this.CurrentPageIndex > this.NumericButtonCount)
    					{
    						num = this.CurrentPageIndex - this.NumericButtonCount;
    					}
    					break;
    				case PagingButtonPosition.Center:
    				{
    					int num2 = this.CurrentPageIndex - (int)Math.Ceiling((double)this.NumericButtonCount / 2.0);
    					if (num2 > 0)
    					{
    						num = num2;
    						if (num > this.PageCount - this.NumericButtonCount)
    						{
    							num = this.PageCount - this.NumericButtonCount;
    						}
    					}
    					break;
    				}
    				}
                   
    			}
    			int num3 = (num + this.NumericButtonCount > this.PageCount) ? this.PageCount : (num + this.NumericButtonCount);
    			if (this.PagingButtonLayoutType == PagingButtonLayoutType.UnorderedList)
    			{
    				writer.RenderBeginTag(HtmlTextWriterTag.Ul);
    			}
    			this.CreateNavigationButton(writer, PagerItemType.First);
    			this.CreateNavigationButton(writer, PagerItemType.Prev);
    			if (this.ShowPageIndex)
    			{
    				if (num > 0)
    				{
    					this.CreateMoreButton(writer, num);
    				}
    				for (int i = num + 1; i <= num3; i++)
    				{
    					this.CreateNumericButton(writer, i);
    				}
    				if (this.PageCount > this.NumericButtonCount && num3 < this.PageCount)
    				{
    					this.CreateMoreButton(writer, num3 + 1);
    				}
    			}
    			this.CreateNavigationButton(writer, PagerItemType.Next);
    			this.CreateNavigationButton(writer, PagerItemType.Last);
    			if (this.PagingButtonLayoutType == PagingButtonLayoutType.UnorderedList)
    			{
    				writer.RenderEndTag();
    			}
    			if (this.ShowPageIndexBox == ShowPageIndexBox.Always || (this.ShowPageIndexBox == ShowPageIndexBox.Auto && this.PageCount >= this.ShowBoxThreshold))
    			{
    				string text = this.UniqueID + "_input";
    				writer.Write("  ");
    				if (!string.IsNullOrEmpty(this.TextBeforePageIndexBox))
    				{
    					writer.Write(this.TextBeforePageIndexBox);
    				}
    				if (this.PageIndexBoxType == PageIndexBoxType.TextBox)
    				{
    					writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
    					writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "30px");
    					writer.AddAttribute(HtmlTextWriterAttribute.Value, this.CurrentPageIndex.ToString());
    					if (!string.IsNullOrEmpty(this.PageIndexBoxStyle))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Style, this.PageIndexBoxStyle);
    					}
    					if (!string.IsNullOrEmpty(this.PageIndexBoxClass))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Class, this.PageIndexBoxClass);
    					}
    					if (!this.Enabled || (this.PageCount <= 1 && this.AlwaysShow))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
    					}
    					writer.AddAttribute(HtmlTextWriterAttribute.Name, text);
    					writer.AddAttribute(HtmlTextWriterAttribute.Id, text);
    					string text2 = string.Concat(new object[]
    					{
    						"ANP_checkInput('",
    						text,
    						"',",
    						this.PageCount,
    						")"
    					});
    					string value = "ANP_keydown(event,'" + this.UniqueID + "_btn');";
    					string text3 = string.Concat(new string[]
    					{
    						"if(",
    						text2,
    						"){ANP_goToPage(document.getElementById('",
    						text,
    						"'));};return false;"
    					});
    					writer.AddAttribute("onkeydown", value);
    					writer.RenderBeginTag(HtmlTextWriterTag.Input);
    					writer.RenderEndTag();
    					if (!string.IsNullOrEmpty(this.TextAfterPageIndexBox))
    					{
    						writer.Write(this.TextAfterPageIndexBox);
    					}
    					if (!string.IsNullOrEmpty(this.SubmitButtonImageUrl))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Type, "image");
    						writer.AddAttribute(HtmlTextWriterAttribute.Src, this.SubmitButtonImageUrl);
    					}
    					else
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Type, this.UrlPaging ? "button" : "submit");
    						writer.AddAttribute(HtmlTextWriterAttribute.Value, this.SubmitButtonText);
    					}
    					writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
    					writer.AddAttribute(HtmlTextWriterAttribute.Id, this.UniqueID + "_btn");
    					if (!string.IsNullOrEmpty(this.SubmitButtonClass))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Class, this.SubmitButtonClass);
    					}
    					if (!string.IsNullOrEmpty(this.SubmitButtonStyle))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Style, this.SubmitButtonStyle);
    					}
    					if (!this.Enabled || (this.PageCount <= 1 && this.AlwaysShow))
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
    					}
    					writer.AddAttribute(HtmlTextWriterAttribute.Onclick, this.UrlPaging ? text3 : string.Concat(new string[]
    					{
    						"if(",
    						text2,
    						"){",
    						this.Page.ClientScript.GetPostBackEventReference(this, null),
    						"} else{return false}"
    					}));
    					writer.RenderBeginTag(HtmlTextWriterTag.Input);
    					writer.RenderEndTag();
    					return;
    				}
    				writer.AddAttribute(HtmlTextWriterAttribute.Name, text);
    				writer.AddAttribute(HtmlTextWriterAttribute.Id, text);
    				writer.AddAttribute(HtmlTextWriterAttribute.Onchange, this.UrlPaging ? "ANP_goToPage(this)" : this.Page.ClientScript.GetPostBackEventReference(this, null));
    				writer.RenderBeginTag(HtmlTextWriterTag.Select);
    				if (this.PageCount > 80)
    				{
    					if (this.CurrentPageIndex <= 15)
    					{
    						this.listPageIndices(writer, 1, 15);
    						AspNetPager.addMoreListItem(writer, 16);
    						this.listPageIndices(writer, this.PageCount - 4, this.PageCount);
    					}
    					else
    					{
    						if (this.CurrentPageIndex >= this.PageCount - 14)
    						{
    							this.listPageIndices(writer, 1, 5);
    							AspNetPager.addMoreListItem(writer, this.PageCount - 15);
    							this.listPageIndices(writer, this.PageCount - 14, this.PageCount);
    						}
    						else
    						{
    							this.listPageIndices(writer, 1, 5);
    							AspNetPager.addMoreListItem(writer, this.CurrentPageIndex - 6);
    							this.listPageIndices(writer, this.CurrentPageIndex - 5, this.CurrentPageIndex + 5);
    							AspNetPager.addMoreListItem(writer, this.CurrentPageIndex + 6);
    							this.listPageIndices(writer, this.PageCount - 4, this.PageCount);
    						}
    					}
    				}
    				else
    				{
    					this.listPageIndices(writer, 1, this.PageCount);
    				}
    				writer.RenderEndTag();
    				if (!string.IsNullOrEmpty(this.TextAfterPageIndexBox))
    				{
    					writer.Write(this.TextAfterPageIndexBox);
    				}
    			}
                //上面的代码省略,此处为要新增的代码
                if (ShowPageSizeBox && this.PageSize < this.RecordCount)
                {
                    string sizeClientId = UniqueID + "_ChangePageSize";
                    writer.Write("  每页显示条数:");
                    writer.AddAttribute(HtmlTextWriterAttribute.Name, sizeClientId);
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, sizeClientId);
                    writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackEventReference(this, null));
    
                    writer.RenderBeginTag(HtmlTextWriterTag.Select);
                    listPageSize(writer);
                    writer.RenderEndTag();
                }
                //结束
    		}
    
            void listPageSize(HtmlTextWriter writer)
            {
                for (int i = 10; i <= 50; i += 5)
                {
                    writer.Write("<option value="");
                    writer.Write(i);
                    writer.Write(""");
                    if (i == PageSize)
                        writer.Write(" selected="true"");
                    writer.Write(">");
                    writer.Write(i);
                    writer.Write("</option>");
                }
            }
    		private string GetHrefString(int pageIndex)
    		{
    			if (!this.UrlPaging)
    			{
    				return this.Page.ClientScript.GetPostBackClientHyperlink(this, pageIndex.ToString());
    			}
    			int num = pageIndex;
    			string str = "pi";
    			if (this.ReverseUrlPageIndex)
    			{
    				str = "(" + this.PageCount + "-pi+1)";
    				num = ((pageIndex == -1) ? -1 : (this.PageCount - pageIndex + 1));
    			}
    			if (this.EnableUrlRewriting)
    			{
    				Regex regex = new Regex("(?<p>%(?<m>[^%]+)%)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
    				MatchCollection matchCollection = regex.Matches(this.UrlRewritePattern);
    				NameValueCollection nameValueCollection = AspNetPager.ConvertQueryStringToCollection(this.queryString);
    				string text = this.UrlRewritePattern;
    				foreach (Match match in matchCollection)
    				{
    					string newValue = nameValueCollection[match.Groups["m"].Value];
    					text = text.Replace(match.Groups["p"].Value, newValue);
    				}
    				return base.ResolveUrl(string.Format(text, (num == -1) ? (""+" + str + "+"") : num.ToString()));
    			}
    			return this.BuildUrlString(this.UrlPageIndexName, (num == -1) ? (""+" + str + "+"") : num.ToString());
    		}
    		private string GetCustomInfoHTML(string origText)
    		{
    			if (!string.IsNullOrEmpty(origText) && origText.IndexOf('%') >= 0)
    			{
    				string[] array = new string[]
    				{
    					"recordcount",
    					"pagecount",
    					"currentpageindex",
    					"startrecordindex",
    					"endrecordindex",
    					"pagesize",
    					"pagesremain",
    					"recordsremain"
    				};
    				StringBuilder stringBuilder = new StringBuilder(origText);
    				Regex regex = new Regex("(?<ph>%(?<pname>\w{8,})%)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
    				MatchCollection matchCollection = regex.Matches(origText);
    				foreach (Match match in matchCollection)
    				{
    					string text = match.Groups["pname"].Value.ToLower();
    					if (Array.IndexOf<string>(array, text) >= 0)
    					{
    						string text2 = null;
    						string key;
    						switch (key = text)
    						{
    						case "recordcount":
    							text2 = this.RecordCount.ToString();
    							break;
    						case "pagecount":
    							text2 = this.PageCount.ToString();
    							break;
    						case "currentpageindex":
    							text2 = this.CurrentPageIndex.ToString();
    							break;
    						case "startrecordindex":
    							text2 = this.StartRecordIndex.ToString();
    							break;
    						case "endrecordindex":
    							text2 = this.EndRecordIndex.ToString();
    							break;
    						case "pagesize":
    							text2 = this.PageSize.ToString();
    							break;
    						case "pagesremain":
    							text2 = this.PagesRemain.ToString();
    							break;
    						case "recordsremain":
    							text2 = this.RecordsRemain.ToString();
    							break;
    						}
    						if (text2 != null)
    						{
    							stringBuilder.Replace(match.Groups["ph"].Value, text2);
    						}
    					}
    				}
    				return stringBuilder.ToString();
    			}
    			return origText;
    		}
    		private static NameValueCollection ConvertQueryStringToCollection(string s)
    		{
    			NameValueCollection nameValueCollection = new NameValueCollection();
    			int num = (s != null) ? s.Length : 0;
    			for (int i = 0; i < num; i++)
    			{
    				int num2 = i;
    				int num3 = -1;
    				while (i < num)
    				{
    					char c = s[i];
    					if (c == '=')
    					{
    						if (num3 < 0)
    						{
    							num3 = i;
    						}
    					}
    					else
    					{
    						if (c == '&')
    						{
    							break;
    						}
    					}
    					i++;
    				}
    				string name = null;
    				string value;
    				if (num3 >= 0)
    				{
    					name = s.Substring(num2, num3 - num2);
    					value = s.Substring(num3 + 1, i - num3 - 1);
    				}
    				else
    				{
    					value = s.Substring(num2, i - num2);
    				}
    				nameValueCollection.Add(name, value);
    				if (i == num - 1 && s[i] == '&')
    				{
    					nameValueCollection.Add(null, string.Empty);
    				}
    			}
    			return nameValueCollection;
    		}
    		private string BuildUrlString(string sk, string sv)
    		{
    			StringBuilder stringBuilder = new StringBuilder(80);
    			bool flag = false;
    			int num = (this.queryString != null) ? this.queryString.Length : 0;
    			for (int i = 0; i < num; i++)
    			{
    				int num2 = i;
    				int num3 = -1;
    				while (i < num)
    				{
    					char c = this.queryString[i];
    					if (c == '=')
    					{
    						if (num3 < 0)
    						{
    							num3 = i;
    						}
    					}
    					else
    					{
    						if (c == '&')
    						{
    							break;
    						}
    					}
    					i++;
    				}
    				string text = null;
    				string value;
    				if (num3 >= 0)
    				{
    					text = this.queryString.Substring(num2, num3 - num2);
    					value = this.queryString.Substring(num3 + 1, i - num3 - 1);
    				}
    				else
    				{
    					value = this.queryString.Substring(num2, i - num2);
    				}
    				stringBuilder.Append(text).Append("=");
    				if (text == sk)
    				{
    					flag = true;
    					stringBuilder.Append(sv);
    				}
    				else
    				{
    					stringBuilder.Append(value);
    				}
    				stringBuilder.Append("&");
    			}
    			if (!flag)
    			{
    				stringBuilder.Append(sk).Append("=").Append(sv);
    			}
    			stringBuilder.Insert(0, "?").Insert(0, Path.GetFileName(this.currentUrl));
    			return stringBuilder.ToString().Trim(new char[]
    			{
    				'&'
    			});
    		}
    		private void CreateNavigationButton(HtmlTextWriter writer, PagerItemType itemType)
    		{
    			if (!this.ShowFirstLast && (itemType == PagerItemType.First || itemType == PagerItemType.Last))
    			{
    				return;
    			}
    			if (!this.ShowPrevNext && (itemType == PagerItemType.Prev || itemType == PagerItemType.Next))
    			{
    				return;
    			}
    			if (itemType == PagerItemType.First || itemType == PagerItemType.Last)
    			{
    				this.AddClassAndStyle(this.FirstLastButtonClass, this.FirstLastButtonStyle, writer);
    			}
    			else
    			{
    				this.AddClassAndStyle(this.NextPrevButtonClass, this.NextPrevButtonStyle, writer);
    			}
    			this.AddPagingButtonLayoutTag(writer);
    			bool flag = this.PagingButtonType == PagingButtonType.Image && this.NavigationButtonType == PagingButtonType.Image;
    			if (itemType == PagerItemType.Prev || itemType == PagerItemType.First)
    			{
    				bool flag2 = this.CurrentPageIndex <= 1 | !this.Enabled;
    				if (!this.ShowDisabledButtons && flag2)
    				{
    					return;
    				}
    				int pageIndex = (itemType == PagerItemType.First) ? 1 : (this.CurrentPageIndex - 1);
    				this.writeSpacingStyle(writer);
    				if (this.PagingButtonLayoutType == PagingButtonLayoutType.None)
    				{
    					if (itemType == PagerItemType.First || itemType == PagerItemType.Last)
    					{
    						this.AddClassAndStyle(this.FirstLastButtonClass, this.FirstLastButtonStyle, writer);
    					}
    					else
    					{
    						this.AddClassAndStyle(this.NextPrevButtonClass, this.NextPrevButtonStyle, writer);
    					}
    				}
    				if (flag)
    				{
    					if (!flag2)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
    						this.AddToolTip(writer, pageIndex);
    						this.AddHyperlinkTarget(writer);
    						writer.RenderBeginTag(HtmlTextWriterTag.A);
    						writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + itemType.ToString() + this.ButtonImageNameExtension + this.ButtonImageExtension);
    						writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    						if (this.ButtonImageAlign != ImageAlign.NotSet)
    						{
    							writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    						}
    						writer.RenderBeginTag(HtmlTextWriterTag.Img);
    						writer.RenderEndTag();
    						writer.RenderEndTag();
    					}
    					else
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + itemType.ToString() + this.DisabledButtonImageNameExtension + this.ButtonImageExtension);
    						writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    						if (this.ButtonImageAlign != ImageAlign.NotSet)
    						{
    							writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    						}
    						writer.RenderBeginTag(HtmlTextWriterTag.Img);
    						writer.RenderEndTag();
    					}
    				}
    				else
    				{
    					string value = (itemType == PagerItemType.Prev) ? this.PrevPageText : this.FirstPageText;
    					if (flag2)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
    					}
    					else
    					{
    						this.AddToolTip(writer, pageIndex);
    						this.AddHyperlinkTarget(writer);
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
    					}
    					writer.RenderBeginTag(HtmlTextWriterTag.A);
    					writer.Write(value);
    					writer.RenderEndTag();
    				}
    			}
    			else
    			{
    				bool flag2 = this.CurrentPageIndex >= this.PageCount | !this.Enabled;
    				if (!this.ShowDisabledButtons && flag2)
    				{
    					return;
    				}
    				int pageIndex = (itemType == PagerItemType.Last) ? this.PageCount : (this.CurrentPageIndex + 1);
    				this.writeSpacingStyle(writer);
    				if (this.PagingButtonLayoutType == PagingButtonLayoutType.None)
    				{
    					if (itemType == PagerItemType.First || itemType == PagerItemType.Last)
    					{
    						this.AddClassAndStyle(this.FirstLastButtonClass, this.FirstLastButtonStyle, writer);
    					}
    					else
    					{
    						this.AddClassAndStyle(this.NextPrevButtonClass, this.NextPrevButtonStyle, writer);
    					}
    				}
    				if (flag)
    				{
    					if (!flag2)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
    						this.AddToolTip(writer, pageIndex);
    						this.AddHyperlinkTarget(writer);
    						writer.RenderBeginTag(HtmlTextWriterTag.A);
    						writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + itemType.ToString() + this.ButtonImageNameExtension + this.ButtonImageExtension);
    						writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    						if (this.ButtonImageAlign != ImageAlign.NotSet)
    						{
    							writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    						}
    						writer.RenderBeginTag(HtmlTextWriterTag.Img);
    						writer.RenderEndTag();
    						writer.RenderEndTag();
    					}
    					else
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + itemType.ToString() + this.DisabledButtonImageNameExtension + this.ButtonImageExtension);
    						writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    						if (this.ButtonImageAlign != ImageAlign.NotSet)
    						{
    							writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    						}
    						writer.RenderBeginTag(HtmlTextWriterTag.Img);
    						writer.RenderEndTag();
    					}
    				}
    				else
    				{
    					string value = (itemType == PagerItemType.Next) ? this.NextPageText : this.LastPageText;
    					if (flag2)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
    					}
    					else
    					{
    						this.AddToolTip(writer, pageIndex);
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
    						this.AddHyperlinkTarget(writer);
    					}
    					writer.RenderBeginTag(HtmlTextWriterTag.A);
    					writer.Write(value);
    					writer.RenderEndTag();
    				}
    			}
    			if (this.PagingButtonLayoutType != PagingButtonLayoutType.None)
    			{
    				writer.RenderEndTag();
    			}
    		}
    		private void AddToolTip(HtmlTextWriter writer, int pageIndex)
    		{
    			if (this.ShowNavigationToolTip)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Title, string.Format(this.NavigationToolTipTextFormatString, pageIndex));
    			}
    		}
    		private void AddPagingButtonLayoutTag(HtmlTextWriter writer)
    		{
    			if (this.PagingButtonLayoutType == PagingButtonLayoutType.UnorderedList)
    			{
    				writer.RenderBeginTag(HtmlTextWriterTag.Li);
    				return;
    			}
    			if (this.PagingButtonLayoutType == PagingButtonLayoutType.Span)
    			{
    				writer.RenderBeginTag(HtmlTextWriterTag.Span);
    			}
    		}
    		private void CreateNumericButton(HtmlTextWriter writer, int index)
    		{
    			bool flag = index == this.CurrentPageIndex;
    			if ((!flag && this.PagingButtonLayoutType != PagingButtonLayoutType.None) || (flag && this.PagingButtonLayoutType == PagingButtonLayoutType.UnorderedList))
    			{
    				if (!flag)
    				{
    					this.AddClassAndStyle(this.PagingButtonClass, this.PagingButtonStyle, writer);
    				}
    				this.AddPagingButtonLayoutTag(writer);
    			}
    			if (this.PagingButtonType == PagingButtonType.Image && this.NumericButtonType == PagingButtonType.Image)
    			{
    				this.writeSpacingStyle(writer);
    				if (!flag)
    				{
    					if (this.Enabled)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(index));
    					}
    					if (this.PagingButtonLayoutType == PagingButtonLayoutType.None)
    					{
    						this.AddClassAndStyle(this.PagingButtonClass, this.PagingButtonStyle, writer);
    					}
    					this.AddToolTip(writer, index);
    					this.AddHyperlinkTarget(writer);
    					writer.RenderBeginTag(HtmlTextWriterTag.A);
    					this.CreateNumericImages(writer, index, false);
    					writer.RenderEndTag();
    				}
    				else
    				{
    					this.AddClassAndStyle(this.CurrentPageButtonClass, this.CurrentPageButtonStyle, writer);
    					writer.RenderBeginTag(HtmlTextWriterTag.Span);
    					this.CreateNumericImages(writer, index, true);
    					writer.RenderEndTag();
    				}
    			}
    			else
    			{
    				this.writeSpacingStyle(writer);
    				if (flag)
    				{
    					if (string.IsNullOrEmpty(this.CurrentPageButtonClass) && string.IsNullOrEmpty(this.CurrentPageButtonStyle))
    					{
    						writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "Bold");
    						writer.AddStyleAttribute(HtmlTextWriterStyle.Color, "red");
    					}
    					else
    					{
    						this.AddClassAndStyle(this.CurrentPageButtonClass, this.CurrentPageButtonStyle, writer);
    					}
    					writer.RenderBeginTag(HtmlTextWriterTag.Span);
    					if (!string.IsNullOrEmpty(this.CurrentPageButtonTextFormatString))
    					{
    						writer.Write(string.Format(this.CurrentPageButtonTextFormatString, index));
    					}
    					else
    					{
    						writer.Write(index);
    					}
    					writer.RenderEndTag();
    				}
    				else
    				{
    					if (this.Enabled)
    					{
    						writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(index));
    					}
    					if (this.PagingButtonLayoutType == PagingButtonLayoutType.None)
    					{
    						this.AddClassAndStyle(this.PagingButtonClass, this.PagingButtonStyle, writer);
    					}
    					this.AddToolTip(writer, index);
    					this.AddHyperlinkTarget(writer);
    					writer.RenderBeginTag(HtmlTextWriterTag.A);
    					if (!string.IsNullOrEmpty(this.NumericButtonTextFormatString))
    					{
    						writer.Write(string.Format(this.NumericButtonTextFormatString, index));
    					}
    					else
    					{
    						writer.Write(index);
    					}
    					writer.RenderEndTag();
    				}
    			}
    			if ((!flag && this.PagingButtonLayoutType != PagingButtonLayoutType.None) || (flag && this.PagingButtonLayoutType == PagingButtonLayoutType.UnorderedList))
    			{
    				writer.RenderEndTag();
    			}
    		}
    		private void CreateNumericImages(HtmlTextWriter writer, int index, bool isCurrent)
    		{
    			this.AddPagingButtonLayoutTag(writer);
    			string text = index.ToString();
    			for (int i = 0; i < text.Length; i++)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Src, string.Concat(new object[]
    				{
    					this.ImagePath,
    					text[i],
    					isCurrent ? this.CpiButtonImageNameExtension : this.ButtonImageNameExtension,
    					this.ButtonImageExtension
    				}));
    				if (this.ButtonImageAlign != ImageAlign.NotSet)
    				{
    					writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    				}
    				writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    				writer.RenderBeginTag(HtmlTextWriterTag.Img);
    				writer.RenderEndTag();
    			}
    			if (this.PagingButtonLayoutType != PagingButtonLayoutType.None)
    			{
    				writer.RenderEndTag();
    			}
    		}
    		private void CreateMoreButton(HtmlTextWriter writer, int pageIndex)
    		{
    			if (!this.ShowMoreButtons)
    			{
    				return;
    			}
    			this.AddClassAndStyle(this.MoreButtonClass, this.MoreButtonStyle, writer);
    			this.AddPagingButtonLayoutTag(writer);
    			this.writeSpacingStyle(writer);
    			writer.AddAttribute(HtmlTextWriterAttribute.Href, this.GetHrefString(pageIndex));
    			this.AddToolTip(writer, pageIndex);
    			this.AddHyperlinkTarget(writer);
    			writer.RenderBeginTag(HtmlTextWriterTag.A);
    			if (this.PagingButtonType == PagingButtonType.Image && this.MoreButtonType == PagingButtonType.Image)
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Src, this.ImagePath + "more" + this.ButtonImageNameExtension + this.ButtonImageExtension);
    				writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
    				if (this.ButtonImageAlign != ImageAlign.NotSet)
    				{
    					writer.AddAttribute(HtmlTextWriterAttribute.Align, this.ButtonImageAlign.ToString());
    				}
    				writer.RenderBeginTag(HtmlTextWriterTag.Img);
    				writer.RenderEndTag();
    			}
    			else
    			{
    				writer.Write("...");
    			}
    			writer.RenderEndTag();
    			if (this.PagingButtonLayoutType != PagingButtonLayoutType.None)
    			{
    				writer.RenderEndTag();
    			}
    		}
    		private void writeSpacingStyle(HtmlTextWriter writer)
    		{
    			if (this.PagingButtonSpacing.Value != 0.0)
    			{
    				writer.AddStyleAttribute(HtmlTextWriterStyle.MarginRight, this.PagingButtonSpacing.ToString());
    			}
    		}
    		private void AddHyperlinkTarget(HtmlTextWriter writer)
    		{
    			if (!string.IsNullOrEmpty(this.UrlPagingTarget))
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Target, this.UrlPagingTarget);
    			}
    		}
    		private void AddClassAndStyle(string clsname, string style, HtmlTextWriter writer)
    		{
    			if (!string.IsNullOrEmpty(clsname))
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Class, clsname);
    			}
    			if (!string.IsNullOrEmpty(style))
    			{
    				writer.AddAttribute(HtmlTextWriterAttribute.Style, style);
    			}
    		}
    		public void RaisePostBackEvent(string args)
    		{
    			int newPageIndex = this.CurrentPageIndex;
    			try
    			{
    				if (string.IsNullOrEmpty(args))
    				{
    					args = this.inputPageIndex;
    				}
    				newPageIndex = int.Parse(args);
    			}
    			catch
    			{
    			}
    			PageChangingEventArgs e = new PageChangingEventArgs(newPageIndex);
    			if (this.cloneFrom != null)
    			{
    				this.cloneFrom.OnPageChanging(e);
    				return;
    			}
    			this.OnPageChanging(e);
    		}
    		public virtual bool LoadPostData(string pkey, NameValueCollection pcol)
    		{
    			string text = pcol[this.UniqueID + "_input"];
    			if (text != null && text.Trim().Length > 0)
    			{
    				try
    				{
    					int num = int.Parse(text);
    					if (num > 0 && num <= this.PageCount)
    					{
    						this.inputPageIndex = text;
    						this.Page.RegisterRequiresRaiseEvent(this);
    					}
    				}
    				catch
    				{
    				}
    			}
    			return false;
    		}
    		public virtual void RaisePostDataChangedEvent()
    		{
    		}
    		protected virtual void OnPageChanging(PageChangingEventArgs e)
    		{
    			this.pageChangeEventHandled = true;
    			PageChangingEventHandler pageChangingEventHandler = (PageChangingEventHandler)base.Events[AspNetPager.EventPageChanging];
    			if (pageChangingEventHandler != null)
    			{
    				pageChangingEventHandler(this, e);
    				if (!e.Cancel || this.UrlPaging)
    				{
    					this.CurrentPageIndex = e.NewPageIndex;
    					this.OnPageChanged(EventArgs.Empty);
    				}
    			}
    			else
    			{
    				this.CurrentPageIndex = e.NewPageIndex;
    				this.OnPageChanged(EventArgs.Empty);
    			}
    			this.pageChangeEventHandled = false;
    		}
    		protected virtual void OnPageChanged(EventArgs e)
    		{
    			EventHandler eventHandler = (EventHandler)base.Events[AspNetPager.EventPageChanged];
    			if (eventHandler != null)
    			{
    				eventHandler(this, e);
    			}
    		}
    	}
    }
    

    A​s​p​N​e​t​P​a​g​e​r​动​态​更​改​P​a​g​e​S​i​z​e​的​方​法:http://wenku.baidu.com/link?url=0a6MzfyEOX4Lq76SWDaZmmbWA-3M11eiuN0ZDHCrlZZ74tpfQ4YOyhztLyIQdawoPtqXBjf8yk6s4E17mYYzwJ4944jswE-Fzjm8BiEtUF3 

    aspnetPager.dll参见附件

  • 相关阅读:
    聊聊关于性能优化和其他(一)
    JavaScript 事件循环及异步原理(完全指北)
    SPA路由机制详解(看不懂不要钱~~)
    Web安全系列(三):XSS 攻击进阶(挖掘漏洞)
    Web安全系列(二):XSS 攻击进阶(初探 XSS Payload)
    浅谈Generator和Promise原理及实现
    Kubernetes 服务目录
    Kubernetes 网络模型
    个人开源贡献记录
    【转载】DTO – 服务实现中的核心数据
  • 原文地址:https://www.cnblogs.com/zhaolijing910/p/3753261.html
Copyright © 2011-2022 走看看