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

推荐订阅源

S
Schneier on Security
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
博客园 - Franky
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
博客园 - 叶小钗
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
TaoSecurity Blog
TaoSecurity Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
爱范儿
爱范儿
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
量子位
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Recent Commits to openclaw:main
Recent Commits to openclaw:main
SecWiki News
SecWiki News
MyScale Blog
MyScale Blog
AI
AI
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 【当耐特】
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
有赞技术团队
有赞技术团队
W
WeLiveSecurity
Project Zero
Project Zero
T
Tor Project blog
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
IT之家
IT之家
The Hacker News
The Hacker News
腾讯CDC
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
C
Cisco Blogs
博客园 - 聂微东
Webroot Blog
Webroot Blog
Forbes - Security
Forbes - Security
M
MIT News - Artificial intelligence
C
Cyber Attacks, Cyber Crime and Cyber Security
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans

博客园 - 子游

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;
            }
        }

   }