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

推荐订阅源

Project Zero
Project Zero
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
S
Schneier on Security
N
News and Events Feed by Topic
N
News | PayPal Newsroom
H
Help Net Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
The Exploit Database - CXSecurity.com
Attack and Defense Labs
Attack and Defense Labs
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
A
About on SuperTechFans
AWS News Blog
AWS News Blog
S
Secure Thoughts
The Cloudflare Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
C
Cybersecurity and Infrastructure Security Agency CISA
V2EX - 技术
V2EX - 技术
Recorded Future
Recorded Future
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
MyScale Blog
MyScale Blog
Martin Fowler
Martin Fowler
Help Net Security
Help Net Security
人人都是产品经理
人人都是产品经理
Latest news
Latest news
C
Cyber Attacks, Cyber Crime and Cyber Security
大猫的无限游戏
大猫的无限游戏
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
月光博客
月光博客
H
Hacker News: Front Page
P
Proofpoint News Feed
N
News and Events Feed by Topic
H
Heimdal Security Blog
L
Lohrmann on Cybersecurity
有赞技术团队
有赞技术团队
L
LangChain Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 子游

Flash / Flex Tutorial – How to Create a crossdomain.xml file javascript 跨越解决方案 Google OAuth 简单入门与使用 Complete Date Object Reference 速强软件 什么是邮件营销 server variables Oracle 笔记 日期处理 如何配置IIS7的Custom Handlers? 分布式系统设计实践 多线程更新Processbar 什么是在线互动营销 导入CSV文件进入系统 - 子游 - 博客园 如何用asp.net做一个图片handler javascript 的 Encode,Javascript,escape,encodeURI,encodeURIComponent,UTF-8 www.sugaroa.com超酷的新一代协同办公自动化系统 超酷的新一代协同办公自动化系统 什么是Rss feed 正确检查上传文件类型或者get mine type from file Sql server 国际化的支持,查询乱码
开发自定义控件 ------------Textbox 控件(1)
子游 · 2009-08-21 · via 博客园 - 子游

                                    

开发自定义控件 __Textbox控件(1)
  支持postback
   public cass SugaroaInput : WebControl
  {

        private static readonly object EventTextChanged = new object();

        //支持事件
        public event EventHandler TextChanged
        {
            add
            {
                base.Events.AddHandler(EventTextChanged, value);
            }
            remove
            {
                base.Events.RemoveHandler(EventTextChanged, value);
            }
        }

       //post back
        protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {

            //Page.ClientScript.ValidateEvent(postDataKey, string.Empty);  
            string text = this.Text;
            string str2 = postCollection[postDataKey];
            if (!this.ReadOnly && !text.Equals(str2, StringComparison.Ordinal))
            {
                this.Text = str2;
                return true;
            }
            return false;
        }
    
      //输出html  

      protected override void Render(HtmlTextWriter writer)
        {
            if (Page != null)
                Page.VerifyRenderingInServerForm(this);
             writer.Write("<input ");
            writer.WriteAttribute("type", "input");
            writer.WriteAttribute("id", this.ClientID );
            writer.WriteAttribute("name", this.ClientID );
           writer.WriteAttribute("value", this.Text, true);
          writer.Write("/> ");

            base.Render(writer);
        }

       //Text change event handler
        protected virtual void OnTextChanged(EventArgs e)
        {
            EventHandler handler = (EventHandler)base.Events[EventTextChanged];
            if (handler != null)
            {
                handler(this, e);
            }
        }

              [Localizable(true), Bindable(true, BindingDirection.TwoWay), PersistenceMode(PersistenceMode.EncodedInnerDefaultProperty), DefaultValue("")]
        public virtual string Text
        {
            get
            {
                string str = (string)this.ViewState["Text"];
                if (str != null)
                {
                    return str;
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["Text"] = value;
            }
        }

   }