欢迎来到天天文库
浏览记录
ID:41560152
大小:65.16 KB
页数:17页
时间:2019-08-27
《ASP分页控件源码_计算机软件及应用_IT计算机_专业资料》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、ASP.Net分页控件源码特性:、支持datagrid,datalist等分种数据显示控件,理论上只耍有datasource的控件都可以、支持u讥方式分页,u讥分页的每一页都可以被搜索引擎搜到,并且支持u讥重写、控件样式可口定义、封装完全,使用过程序只需写一行代码复制代码代码如下:**文件名:Pager.cs**创建人:杨响武**口期:2005年7川27口**修改人:**口期:**描述:*******寧*寧*******寧*寧*寧********:{c****寧*******寧*寧*寧*****寧***********寧/usingSystem;usingSystcm.Wcb.UI.WcbCo
2、ntrols;usingSystcm.Wcb.UI.HtmlControls;usingSystem.Web;usingSystem.Web.UI;usingSystem.Text.RegularExpressions;namespaceMyCompany.Controls{//////分页控件///publicclassPager:Label,INamingContaincr{#region成员变量和构造函数HttpContextcontext=HttpContext.Current;LabelcountLabel;HyperLinkpreviousBu
3、tton;HyperLinkncxtButton;HyperLinkflrstButton;HyperLinklastButton;HyperLink[]pagingLinkButtons;publicoverrideControlCollectionControls(get{EnsureChildControls();returnbase.Controls;protectedoverridevoidCreateChildControls()Conlrols.Clear();AddCountLabcl();AddPagcButtons();AddPreviousNextHyperLinks()
4、;AddFirstLastHyperLinksO;}#cndrcgion#region呈现方法protectedoverridevoidRender(HtmlTextWriterwriter){//修改总页数小于等于1的时候不呈现任何控件//inttotalPages=CalculatcTotalPagcs();////if(totalPages<=1)//return;writer.AddAuribuie(HtmITex(WriierAUribule.Class,this.CssClass,false);RenderCounlLabel(wriler);RcndcrFirst(writcr)
5、;RcndcrPrcvious(writcr);RenderPagingButtons(writer);RenderNext(writer);RendcrLast(writcr);IvoidRenderCountLabeI(HtmlTextWriterwriter){countLabel.RenderControl(writer);LiteralControl1=newLiteralControl(Hn);LRenderControl(writer);firstButton.RenderControl(writer);LiteralControlI=newLiteralControl(,fn)
6、;I.RenderControl(writer);)voidRcndcrLast(HtnilTcxtWritcrwriter){lastButton.RenderControl(writer);LiteralControlI=newLiteralControl(Hu);LRcndcrControl(writcr);)voidRenderPrevious(HtmlTextWriterwriter)previousButton.RenderControl(writer);LiteralControl1=newLitcraIControl(nH);LRenderControl(writer);)ne
7、xtButton.RenderControl(writer);LiteralControl1=newLiteralControl(nH);LRenderControl(wriler);)privatevoidRcndcrButtonRangc(intstart,intend,HtmllcxtWritcrwriter){for(inti=start;i
此文档下载收益归作者所有