简单的分页控件SimplePager,支持datagrid,datalist,repeater

除了第一个乱七八糟的可输入可选择的DropDownList外,这算第二个控件吧,
有空改善一下
使用方法
1、设置分页控件绑定字符串BindControlString的datagrid之类的id
2、在使用页面的Page_Load()里面写上

 

ContractedBlock.gif ExpandedBlockStart.gif
None.gifusing System;
None.gif
using System.Web.UI;
None.gif
using System.Web.UI.WebControls;
None.gif
using System.Web;
None.gif
using System.Data;
None.gif
using System.Diagnostics;
None.gif
using System.ComponentModel;
None.gif
using System.Web.UI.Design;
None.gif
using System.Text;
None.gif
using System.Drawing;
None.gif
None.gif
namespace HMG.WebControls
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 数据提供的委托
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public delegate DataTable PagerDataProvider();
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    
设计期支持(已完成)#region 设计期支持(已完成)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// SimplePager的设计期支持
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class SimplePagerDesigner:ControlDesigner
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 设计期的Html
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns> 设计期的Html</returns>

InBlock.gif        public override string GetDesignTimeHtml()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
InBlock.gif            SimplePager temp
=(SimplePager)this.Component;
InBlock.gif            StringBuilder sb
=new StringBuilder();
InBlock.gif            sb.Append(
"<div >");
InBlock.gif            sb.Append(temp.GetDescription());
InBlock.gif            sb.Append(
"  ");
InBlock.gif            sb.Append(temp.ButtonStrings.ToString());
InBlock.gif            sb.Append(
"<input type='text' style='border:solid 1px black;width:40px'></input>");
InBlock.gif            sb.Append(
"<a style='width:40px'>"+temp.ButtonStrings.Go+"</a>");
InBlock.gif            sb.Append(
"</div>");
InBlock.gif            
return sb.ToString();
InBlock.gif        
InBlock.gif
InBlock.gif            
//return base.GetDesignTimeHtml ();
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 默认初始化
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="component">暂时没有用到</param>

InBlock.gif        public override void Initialize(IComponent component)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif        
InBlock.gif            
base.Initialize (component);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif    
按钮字符提供者,复合属性(已完成)#region 按钮字符提供者,复合属性(已完成)
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 按钮字符提供者,复合属性(已完成)
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    [TypeConverter(typeof(ExpandableObjectConverter))]
InBlock.gif    
public class ButtonStringProvider
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
InBlock.gif        
private string pre;
InBlock.gif        
private string end;
InBlock.gif        
private string first;
InBlock.gif        
private string next;
InBlock.gif        
private string go;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 重写的ToString
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns>首页,尾页,上一页,下一页</returns>

InBlock.gif        public override string ToString()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return first+" | "+end+" | "+pre+" | "+next;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 默认构造函数
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public ButtonStringProvider():this("首页","尾页","上一页","下一页","跳到")
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 带参数的构造函数
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="first">首页的Text</param>
InBlock.gif        
/// <param name="end">尾页的Text</param>
InBlock.gif        
/// <param name="pre">上一页的Text</param>
InBlock.gif        
/// <param name="next">下一页的Text</param>
ExpandedSubBlockEnd.gif        
/// <param name="go">跳转的Text</param>

InBlock.gif        public ButtonStringProvider(string first,string end,string pre,string next,string go)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.first=first;
InBlock.gif            
this.end=end;
InBlock.gif            
this.pre=pre;
InBlock.gif            
this.next=next;
InBlock.gif            
this.go=go;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 跳转的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [NotifyParentProperty(true)]
InBlock.gif        [DefaultValue(
"跳到")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        
public string Go
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.go;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.go=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 下一页的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue("下一页")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        [NotifyParentProperty(
true)]
InBlock.gif        
public string Next
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.next;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.next=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 上一页的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue("上一页")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        [NotifyParentProperty(
true)]
InBlock.gif        
public string Pre
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.pre;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.pre=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 尾页的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue("尾页")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        [NotifyParentProperty(
true)]
InBlock.gif        
public string End
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.end;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.end=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 首页的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue("首页")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        [NotifyParentProperty(
true)]
InBlock.gif        
public string First
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.first;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.first=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif    
#endregion

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// SimplePager 的摘要说明。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    [
InBlock.gif    ParseChildren(
true),
InBlock.gif    PersistChildren(
false),
InBlock.gif    Designer(
typeof(SimplePagerDesigner))
InBlock.gif    ]
InBlock.gif    [ToolboxBitmapAttribute(
typeof(SimplePager), "SimplePager.bmp")] 
InBlock.gif    [DefaultProperty(
"FormatString"),
InBlock.gif    ToolboxData(
"<{0}:SimplePager  runat=\"server\"></{0}:SimplePager>")]
InBlock.gif    
public class SimplePager:System.Web.UI.WebControls.WebControl,INamingContainer
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取信息描述,比如当前页{0}/{1},总记录数{2}
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns>信息描述</returns>

InBlock.gif        public string GetDescription()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
return string.Format(this.FormatString,new object[]dot.gif{this.CurrentPageIndex,this.TotalPages,this.TotalRecordSize});
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 提供数据源的方法
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private PagerDataProvider provider;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 提供数据源的方法
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public PagerDataProvider Provider
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return provider;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                provider
=value;            
InBlock.gif                
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
ContractedSubBlock.gifExpandedSubBlockStart.gif        
超级链接列#region 超级链接列
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 首页
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private System.Web.UI.WebControls.LinkButton lbFirst;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>20
InBlock.gif        
/// 尾页
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private LinkButton lbEnd;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 上一页
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private LinkButton lbPre;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 下一页
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private LinkButton lbNext;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 跳转
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private LinkButton lbGo;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前页
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private TextBox tbNum;
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
设置各个链接列的字#region 设置各个链接列的字
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 设置所有链接按钮的Text
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),NotifyParentProperty(true)]
InBlock.gif        [PersistenceMode(PersistenceMode.InnerProperty)]
InBlock.gif        
public ButtonStringProvider ButtonStrings
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(this.buttonStrs==null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
this.buttonStrs=new ButtonStringProvider();
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return this.buttonStrs;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
private ButtonStringProvider buttonStrs=new ButtonStringProvider();
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
字符串#region 字符串
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 格式化字符串 必须包括page {0} of {1} all{2]record
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string formatStr="当前页{0}/{1},共{2}条记录";
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 格式化字符串 必须包括page {0} of {1} all{2]record
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue("当前页{0}/{1},共{2}条记录")]
InBlock.gif        [Browsable(
true)]
InBlock.gif        
public string FormatString
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.formatStr;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(this.formatStr.IndexOf("{0}")==-1||this.formatStr.IndexOf("{1}")==-1||this.formatStr.IndexOf("{2}")==-1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("格式字符串必须包括{0},{1},{2}");
InBlock.gif                    
ExpandedSubBlockEnd.gif                }

InBlock.gif                
this.formatStr=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 绑定的控件名称
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string bindControl;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 绑定的控件名称
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string BindControlString
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.bindControl;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.bindControl=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 绑定的控件
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [Browsable(false)]
InBlock.gif        
public Control BindedControl
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
InBlock.gif                
//Control sender =this.OwnerPage.FindControl(this.bindControl);
InBlock.gif
                this.EnsureChildControls();
InBlock.gif                Control sender
=this.Page.FindControl(this.bindControl);
InBlock.gif                
return sender;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
InBlock.gif        
//private string delegateMethod;
InBlock.gif

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 初始化
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="e">参数</param>

InBlock.gif        protected override void OnInit(EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//this.BindControl.DataBinding+=new EventHandler(BindControl_DataBinding);
InBlock.gif
            base.OnInit (e);
InBlock.gif            
InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
InBlock.gif        
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
ViewState的属性#region ViewState的属性
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 是否发生需要重新绑定
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue(true)]
InBlock.gif        [Browsable(
true)]
InBlock.gif        
public bool Changed
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ViewState["changed"]==null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ViewState[
"changed"]=true;
InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return Convert.ToBoolean(ViewState["changed"].ToString());
InBlock.gif
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ViewState[
"changed"]=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 页记录数大小
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue(10)]
InBlock.gif        [Browsable(
true)]
InBlock.gif        
public int PageSize
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ViewState["pagesize"]==null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ViewState[
"pagesize"]=10;
InBlock.gif                    
ExpandedSubBlockEnd.gif                }

InBlock.gif                
int result=Convert.ToInt32(ViewState["pagesize"]);
InBlock.gif                
if(result<1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("页的大小必须大于1!");
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return result;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(value<1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("页的大小必须大于1!");
ExpandedSubBlockEnd.gif                }

InBlock.gif                ViewState[
"pagesize"]=value;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前页索引,格式字符串的{0}
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif
InBlock.gif        [DefaultValue(
0)]
InBlock.gif        [Browsable(
false)]
InBlock.gif        
public int CurrentPageIndex
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ViewState["currentpageindex"]==null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ViewState[
"currentpageindex"]=1;
InBlock.gif                    
ExpandedSubBlockEnd.gif                }

InBlock.gif                
int result=Convert.ToInt32(ViewState["currentpageindex"]);
InBlock.gif                
if(result<1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("当前页不得小于1!");
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return result;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(value<1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("当前页不得小于1!");
ExpandedSubBlockEnd.gif                }

InBlock.gif                ViewState[
"currentpageindex"]=value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 记录总数-格式字符串的{2}
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [DefaultValue(0)]
InBlock.gif        [Browsable(
false)]
InBlock.gif        
public int TotalRecordSize
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ViewState["totalrecordsize"]==null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ViewState[
"totalrecordsize"]=0;
InBlock.gif                    
ExpandedSubBlockEnd.gif                }

InBlock.gif                
int result=Convert.ToInt32(ViewState["totalrecordsize"]);
InBlock.gif                
if(result<0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("记录数不得小于0!");
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return result;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ViewState[
"totalrecordsize"]=value;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif        
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 重写的Render方法
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="writer">输出流</param>

InBlock.gif        protected override void Render(HtmlTextWriter writer)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            writer.AddAttribute(HtmlTextWriterAttribute.Id,
this.ClientID);
InBlock.gif            writer.RenderBeginTag(HtmlTextWriterTag.Span);
InBlock.gif            writer.Write(
this.GetDescription());
InBlock.gif            writer.Write(
"  ");
InBlock.gif            
this.lbFirst.RenderControl(writer);
InBlock.gif            writer.Write(
" | ");
InBlock.gif            
this.lbEnd.RenderControl(writer);
InBlock.gif            writer.Write(
" | ");
InBlock.gif            
this.lbPre.RenderControl(writer);
InBlock.gif            writer.Write(
" | ");
InBlock.gif            
this.lbNext.RenderControl(writer);
InBlock.gif            writer.Write(
"  ");
InBlock.gif            
this.tbNum.RenderControl(writer);
InBlock.gif            writer.Write(
" ");
InBlock.gif            
this.lbGo.RenderControl(writer);
InBlock.gif
InBlock.gif            writer.RenderEndTag();
//Span
InBlock.gif            
//base.Render (writer);
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 事件冒泡,暂时没有使用
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="source">事件源</param>
InBlock.gif        
/// <param name="args">参数</param>
ExpandedSubBlockEnd.gif        
/// <returns>是否冒泡</returns>

InBlock.gif        protected override bool OnBubbleEvent(object source, EventArgs args)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return base.OnBubbleEvent (source, args);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 注册控件为需要回传的事件
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="e"></param>

InBlock.gif        protected override void OnPreRender(EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(this.Changed)
InBlock.gif              
this.BindData();
InBlock.gif            
base.OnPreRender (e);
InBlock.gif            
//Page.RegisterRequiresPostBack(this);
InBlock.gif
            
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 重写的构造函数
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif
InBlock.gif        
protected override void CreateChildControls()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//base.CreateChildControls ();
InBlock.gif
            Controls.Clear();
InBlock.gif            
this.lbFirst=new LinkButton();
InBlock.gif            
this.lbFirst.ID="lbFirst";
InBlock.gif            lbFirst.Text
=this.ButtonStrings.First;
InBlock.gif            
this.lbFirst.Click+=new EventHandler(lbFirst_Click);
InBlock.gif            
this.Controls.Add(this.lbFirst);
InBlock.gif            
InBlock.gif            
this.lbPre=new LinkButton();
InBlock.gif            
this.lbPre.ID="lbPre";
InBlock.gif            
this.lbPre.Text=this.ButtonStrings.Pre;
InBlock.gif            
this.lbPre.Click+=new EventHandler(lbPre_Click);
InBlock.gif            
this.Controls.Add(this.lbPre);
InBlock.gif            
InBlock.gif            
this.lbNext=new LinkButton();
InBlock.gif            
this.lbNext.ID="lbNext";
InBlock.gif            
this.lbNext.Text=this.ButtonStrings.Next;
InBlock.gif            
this.lbNext.Click+=new EventHandler(lbNext_Click);
InBlock.gif            
this.Controls.Add(this.lbNext);
InBlock.gif            
InBlock.gif            
this.lbEnd=new LinkButton();
InBlock.gif            
this.lbEnd.ID="lbEnd";
InBlock.gif            
this.lbEnd.Text=this.ButtonStrings.End;
InBlock.gif            
this.lbEnd.Click+=new EventHandler(lbEnd_Click);
InBlock.gif            
this.Controls.Add(this.lbEnd);
InBlock.gif    
InBlock.gif            
this.tbNum=new TextBox();
InBlock.gif            
this.tbNum.ID="tbNum";
InBlock.gif            
this.tbNum.Width=30;
InBlock.gif            
this.tbNum.Style.Add("border","solid 1px black;");
InBlock.gif            
this.tbNum.Text=this.CurrentPageIndex.ToString();
InBlock.gif            
this.Controls.Add(this.tbNum);
InBlock.gif        
InBlock.gif            
this.lbGo=new LinkButton();
InBlock.gif            
this.lbGo.ID="lbGo";
InBlock.gif            
this.lbGo.Text=this.ButtonStrings.Go;
InBlock.gif            
this.lbGo.Click+=new EventHandler(lbGo_Click);
InBlock.gif            
this.Controls.Add(this.lbGo);
InBlock.gif            
//this.BindedControl.DataBinding+=new EventHandler(BindControl_DataBinding);
InBlock.gif

InBlock.gif            
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 默认构造函数
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public SimplePager()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// TODO: 在此处添加构造函数逻辑
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前页记录起始行
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private int StartRow
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return (this.CurrentPageIndex-1)*this.PageSize;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 是否允许数据绑定
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        [
InBlock.gif        Browsable(
true)
InBlock.gif        ]
InBlock.gif        
public bool AllowBinded
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (ViewState["allowbinded"== null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    ViewState[
"allowbinded"= false;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return (bool)ViewState["allowbinded"];
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ViewState[
"allowbinded"= value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前页结束的行数
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private int EndRow
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif
InBlock.gif                
int t=(this.CurrentPageIndex)*this.PageSize-1;
InBlock.gif                
return t<this.TotalRecordSize?t+1:this.TotalRecordSize;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 总的页数
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private int TotalPages
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
int temp=this.TotalRecordSize/this.PageSize;
InBlock.gif                
if (temp == 0)
InBlock.gif                    
return 1;
InBlock.gif                
if(this.TotalRecordSize%this.PageSize>0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    temp
++;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return temp;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 从数据源取的数据筛选出当前页的数据来
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns>新的DataTable</returns>

InBlock.gif        private DataTable PreData()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif           
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                DataTable dt
=this.provider();
InBlock.gif                
if(dt!=null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
this.TotalRecordSize=dt.Rows.Count;
InBlock.gif                    
if(this.TotalPages<this.CurrentPageIndex)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.CurrentPageIndex=this.TotalPages;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    Debug.WriteLine(
"记录总数:"+this.TotalRecordSize);
InBlock.gif                    Debug.WriteLine(
"起始记录:"+this.StartRow);
InBlock.gif                    Debug.WriteLine(
"结束记录:"+this.EndRow);
InBlock.gif                    DataTable temp
=dt.Clone();
InBlock.gif                    
for(int i=this.StartRow;i<this.EndRow;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        temp.ImportRow(dt.Rows[i]);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                
InBlock.gif
InBlock.gif                    
return temp;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
this.lbFirst.Enabled = false;
InBlock.gif                    
this.lbPre.Enabled = false;
InBlock.gif                    
this.lbNext.Enabled = false;
InBlock.gif                    
this.lbEnd.Enabled = false;
InBlock.gif                    
return null;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception ex)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Debug.WriteLine(ex.ToString());
InBlock.gif                
throw new ArgumentException("提供的数据源不能转化为DataView");
InBlock.gif                
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 点击跳转按钮的事件
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sender">跳转按钮</param>
ExpandedSubBlockEnd.gif        
/// <param name="e">事件参数</param>

InBlock.gif    
InBlock.gif        
private void lbGo_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
int newIndex=Convert.ToInt32(this.tbNum.Text);
InBlock.gif                
if(newIndex>=1&&newIndex<=this.TotalPages)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
this.CurrentPageIndex=newIndex;
InBlock.gif                    
this.Changed=true;
InBlock.gif                    
this.BindData();
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
this.tbNum.Text=this.CurrentPageIndex.ToString();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 点击尾页的按钮事件
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sender">尾页按钮</param>
ExpandedSubBlockEnd.gif        
/// <param name="e">事件参数</param>

InBlock.gif        private void lbEnd_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.CurrentPageIndex=this.TotalPages;
InBlock.gif            
this.Changed=true;
InBlock.gif            
this.BindData();
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 点击下一页的按钮事件
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sender">下一页按钮</param>
ExpandedSubBlockEnd.gif        
/// <param name="e">事件参数</param>

InBlock.gif        private void lbNext_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(this.CurrentPageIndex<this.TotalPages)
InBlock.gif            
this.CurrentPageIndex++;
InBlock.gif            
this.Changed=true;
InBlock.gif            
this.BindData();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 点击前一页的按钮事件
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sender">前一页按钮</param>
ExpandedSubBlockEnd.gif        
/// <param name="e">事件参数</param>

InBlock.gif        private void lbPre_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(this.CurrentPageIndex>1)
InBlock.gif            
this.CurrentPageIndex--;
InBlock.gif            
this.Changed=true;
InBlock.gif            
this.BindData();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 点击首页发生的事件
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sender">首页按钮</param>
ExpandedSubBlockEnd.gif        
/// <param name="e">事件参数</param>

InBlock.gif        private void lbFirst_Click(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.CurrentPageIndex=1;
InBlock.gif            
this.Changed=true;
InBlock.gif            
this.BindData();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 控件的数据绑定
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif
InBlock.gif        
private void BindData()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (!this.AllowBinded)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.lbFirst.Enabled = false;
InBlock.gif                
this.lbPre.Enabled = false;
InBlock.gif                
this.lbNext.Enabled = false;
InBlock.gif                
this.lbEnd.Enabled = false;
InBlock.gif                
this.lbGo.Enabled = false;
InBlock.gif
InBlock.gif                
return;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else if(this.Changed)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.lbGo.Enabled = true;
InBlock.gif                Control sender 
= this.BindedControl;
InBlock.gif                
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (sender is DataGrid)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        DataGrid dg 
= (DataGrid)sender;
InBlock.gif                        DataTable dt 
= this.PreData();
InBlock.gif                        
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif
InBlock.gif                            dg.DataSource 
= dt;
InBlock.gif                            dg.DataBind();
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
return;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else if (sender is Repeater)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        Repeater rp 
= (Repeater)sender;
InBlock.gif                        DataTable dt 
= this.PreData();
InBlock.gif                        
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            rp.DataSource 
= dt;
InBlock.gif                            rp.DataBind();
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
return;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else if (sender is DataList)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        DataList list 
= (DataList)sender;
InBlock.gif                        DataTable dt 
= this.PreData();
InBlock.gif                        
if (dt != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            list.DataSource 
= dt;
InBlock.gif                            list.DataBind();
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
return;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
throw new ArgumentException("绑定的控件仅支持DataGrid,DataList,Repeater");
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
if(this.TotalPages==1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif
InBlock.gif                        
this.lbFirst.Enabled = false;
InBlock.gif                        
this.lbPre.Enabled = false;
InBlock.gif                        
this.lbNext.Enabled = false;
InBlock.gif                        
this.lbEnd.Enabled = false;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else if (this.CurrentPageIndex == this.TotalPages)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.lbFirst.Enabled = true;
InBlock.gif                        
this.lbPre.Enabled = true;
InBlock.gif                        
this.lbNext.Enabled = false;
InBlock.gif                        
this.lbEnd.Enabled = false;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
InBlock.gif                    
else if (this.CurrentPageIndex == 1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
this.lbFirst.Enabled = false;
InBlock.gif                        
this.lbPre.Enabled = false;
InBlock.gif                        
this.lbNext.Enabled = true;
InBlock.gif
InBlock.gif                        
this.lbEnd.Enabled = true;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else if (this.CurrentPageIndex > 1 && this.CurrentPageIndex < this.TotalPages)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif
InBlock.gif                        
this.lbFirst.Enabled = true;
InBlock.gif                        
this.lbPre.Enabled = true;
InBlock.gif                        
this.lbNext.Enabled = true;
InBlock.gif
InBlock.gif                        
this.lbEnd.Enabled = true;
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
this.tbNum.Text = this.CurrentPageIndex.ToString();
InBlock.gif                    
this.Changed=false;
InBlock.gif
InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif                
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
throw new ArgumentException("请提供一个可以转化为dataview的数据源!");
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif



代码如下:

分页以及验证测试工程

转载于:https://www.cnblogs.com/deadshot123/archive/2006/12/01/579105.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值