惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
月光博客
月光博客
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
TaoSecurity Blog
TaoSecurity Blog
V
Visual Studio Blog
博客园 - 叶小钗
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
罗磊的独立博客
雷峰网
雷峰网
T
Tor Project blog
L
LINUX DO - 最新话题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
Scott Helme
Scott Helme
Spread Privacy
Spread Privacy
C
CERT Recently Published Vulnerability Notes
腾讯CDC
Cloudbric
Cloudbric
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
T
Troy Hunt's Blog
T
Threatpost
C
Check Point Blog
Vercel News
Vercel News
I
Intezer
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
D
DataBreaches.Net
SecWiki News
SecWiki News
Help Net Security
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
AI
AI
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - Rain@sz

C#多线程编程(转) 调用webservice类(转) webService动态编译(编译在内存中,不会有权限问题) 什么是AOP? (摘) 阿里巴巴信息抓取器 脏读、不可重复读和虚读。(数据库)摘 c#写Activex控件(.Net 2.0) SPS中模拟登陆 sql server 2005分页存储过程和sql server 2000分页存储过程(摘) net的辅助工具 ajax基本函数--js Memento Pattern(备忘录模式) Interpreter Pattern(解释器模式) State Pattern(状态模式) Mediator Pattern(中介者模式) 动态调用Webservice(摘) RSS 标准 DP-還未添加 DP-职责链模式(Chain of Responsibility)
分页--页脚控件
Rain@sz · 2007-10-09 · via 博客园 - Rain@sz

  1using System;
  2using System.Collections.Generic;
  3using System.ComponentModel;
  4using System.Text;
  5using System.Web;
  6using System.Web.UI;
  7using System.Web.UI.WebControls;
  8
  9namespace CustomerControl
 10{
 11    [DefaultProperty("Text")]
 12    [ToolboxData("<{0}:Pager runat=server></{0}:Pager>")]
 13    public class Pager : WebControl,INamingContainer
 14    {
 15        public event PagerHander First;
 16        public event PagerHander Prvi;
 17        public event PagerHander Next;
 18        public event PagerHander Last;
 19        public event PagerHander Go;
 20
 21        public delegate void PagerHander(object sender, PagerEventArgs e);
 22
 23        //下一页
 24        private Button _btnNext;
 25        //上一页
 26        private Button _btnPrvi;
 27        //页码
 28        private TextBox txtPage;
 29        //到达页码
 30        private Button _btnGo;
 31        //最后一页
 32        private Button _btnLast;
 33        //第一页
 34        private Button _btnFirst;
 35        //当前页
 36        private TextBox _txtCurrentPage;
 37        //每页的条数
 38        private string _PageCount = "10";
 39        //总条数
 40        private string _RecordCount;
 41        
 42
 43
 44        [Bindable(true)]
 45        [Category("Appearance")]
 46        [DefaultValue("10")]
 47        [Localizable(true)]
 48        public string PageCount
 49        {
 50            get
 51            {
 52                _PageCount = (string)ViewState["PageCount"];
 53                return ((_PageCount == null? "10" : _PageCount);
 54            }

 55
 56            set
 57            {
 58                _PageCount = value;
 59                ViewState["PageCount"= _PageCount;
 60            }

 61        }

 62
 63        [Bindable(true)]
 64        [Category("Appearance")]
 65        [DefaultValue("")]
 66        [Localizable(true)]
 67        public string RecordCount
 68        {
 69            get
 70            {
 71                _RecordCount = (string)ViewState["RecordCount"];
 72                return ((_RecordCount == null? "0" : _RecordCount);
 73            }

 74
 75            set
 76            {
 77                _RecordCount = value;
 78                ViewState["RecordCount"= _RecordCount;
 79            }

 80        }

 81
 82        private string _StateCss;
 83        [Bindable(true)]
 84        [Category("Appearance")]
 85        [DefaultValue("")]
 86        [Localizable(true)]
 87        public string StateCss
 88        {
 89            get
 90            {
 91                _StateCss = (string)ViewState["StateCss"];
 92                return ((_StateCss == null? string.Empty : _StateCss);
 93            }

 94
 95            set
 96            {
 97                _StateCss = value;
 98                ViewState["StateCss"= _StateCss;
 99            }

100        }

101
102        private string _ButtonCss;
103        [Bindable(true)]
104        [Category("Appearance")]
105        [DefaultValue("")]
106        [Localizable(true)]
107        public string ButtonCss
108        {
109            get
110            {
111                _ButtonCss = (string)ViewState["ButtonCss"];
112                return ((_ButtonCss == null? string.Empty : _ButtonCss);
113            }

114
115            set
116            {
117                _ButtonCss = value;
118                ViewState["ButtonCss"= _ButtonCss;
119            }

120        }

121
122        private string _txtCss;
123        [Bindable(true)]
124        [Category("Appearance")]
125        [DefaultValue("")]
126        [Localizable(true)]
127        public string TxtCss
128        {
129            get
130            {
131                _txtCss = (string)ViewState["TxtCss"];
132                return ((_txtCss == null? string.Empty : _txtCss);
133            }

134
135            set
136            {
137                _txtCss = value;
138                ViewState["TxtCss"= _txtCss;
139            }

140        }

141
142        私有函数 
194
195        go event
243
244        Last Event
271
272        Next Event
300
301        Prvi Event
326
327        Frist Evetn
347
348        protected override void CreateChildControls()
349        {
350            _btnFirst = new Button();
351            _btnFirst.ID = "btnFirst";
352            _btnFirst.Text = "9";
353            _btnFirst.Enabled = false;
354            _btnFirst.CssClass = this.ButtonCss;
355            _btnFirst.Click += new EventHandler(_btnFirst_Click);
356            this.Controls.Add(_btnFirst);
357
358            _btnPrvi = new Button();
359            _btnPrvi.ID = "btnPrvi";
360            _btnPrvi.Text = "3";
361            _btnPrvi.Enabled = false;
362            _btnPrvi.CssClass = this.ButtonCss;
363            _btnPrvi.Click += new EventHandler(_btnPrvi_Click);
364            this.Controls.Add(_btnPrvi);
365
366            _btnNext = new Button();
367            _btnNext.ID = "btnNext";
368            _btnNext.Text = "4";
369            _btnNext.CssClass = this.ButtonCss;
370            _btnNext.Click += new EventHandler(_btnNext_Click);
371            this.Controls.Add(_btnNext);
372
373            _btnLast = new Button();
374            _btnLast.ID = "btnLast";
375            _btnLast.Text = ":";
376            _btnLast.CssClass = this.ButtonCss;
377            _btnLast.Click += new EventHandler(_btnLast_Click);
378            this.Controls.Add(_btnLast);
379
380            txtPage = new TextBox();
381            txtPage.ID = "txtPage";
382            txtPage.CssClass = this.TxtCss;
383            txtPage.Width = new Unit(20);
384            this.Controls.Add(txtPage);
385
386            _btnGo = new Button();
387            _btnGo.ID = "btnGo";
388            _btnGo.Text = "2";
389            _btnGo.CssClass = this.ButtonCss;
390            _btnGo.Click += new EventHandler(_btnGo_Click);
391            this.Controls.Add(_btnGo);
392
393            _txtCurrentPage = new TextBox();
394            _txtCurrentPage.ID = "txtCurrentPage";
395            _txtCurrentPage.Text = "0";
396            _txtCurrentPage.Visible = false;
397            this.Controls.Add(_txtCurrentPage);
398        }

399
400        protected override void Render(HtmlTextWriter output)
401        {
402            int TotalPage = Int32.Parse(RecordCount) / Int32.Parse(PageCount);
403            if (Int32.Parse(RecordCount) % Int32.Parse(PageCount) > 0)
404                TotalPage += 1;
405            output.Write("<table><tr><td class = '"+ this.StateCss +"'>页码:" + (Int32.Parse(_txtCurrentPage.Text) + 1+ "/" + TotalPage + ",共" + RecordCount + "条</td><td class='"+ this.ButtonCss +"'><font face='webdings'>");
406            _btnFirst.RenderControl(output);
407            _btnPrvi.RenderControl(output);
408            _btnNext.RenderControl(output);
409            _btnLast.RenderBeginTag(output);
410            txtPage.RenderControl(output);
411            _btnGo.RenderControl(output);
412            _txtCurrentPage.RenderControl(output);
413            output.Write("</font></td></tr></table>");
414        }

415    }

416
417    public class PagerEventArgs
418    {
419        private int _CurrentPage;
420
421        public int CurrentPage
422        {
423            get return _CurrentPage; }
424            set { _CurrentPage = value; }
425        }

426    }

427}

428