• Building ASP.NET Server ControlsTextbox.cs


    // Title: Building ASP.NET Server Controls
    //
    // Chapter: 4 - State Management
    // File: Textbox.cs
    // Written by: Dale Michalk and Rob Cameron
    //
    // Copyright ?2003, Apress L.P.
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Collections.Specialized;
    using System.ComponentModel;

    namespace ControlsBookLib.Ch04
    {
       [ToolboxData("<{0}:Textbox runat=server></{0}:Textbox>"),
       DefaultProperty("Text")]
       public class Textbox : Control, IPostBackDataHandler
       {
           public virtual string Text
          {
             get
             {
                object text = ViewState["Text"];
                if (text == null)
                   return string.Empty;
                else
                   return (string) text;
             }
             set
             {
                ViewState["Text"] = value;
             }
          }

          public bool LoadPostData(string postDataKey,
             NameValueCollection postCollection)
          {
             string postedValue = postCollection[postDataKey];
             Text = postedValue;
             return false;
          }

          public virtual void RaisePostDataChangedEvent()
          {

          }

          override protected void Render(HtmlTextWriter writer)
          {
             Page.VerifyRenderingInServerForm(this);

             base.Render(writer);

             // write out the <INPUT type="text"> tag
             writer.Write("<INPUT type=\"text\" name=\"");
             writer.Write(this.UniqueID);
             writer.Write("\" value=\"" + this.Text + "\" />");
          }
       }
    }
  • 相关阅读:
    网站收录(2)-财经网站
    网络爬虫(13)-Scrapy持久化存储
    网络爬虫(12)-Scrapy框架Post请求发送
    Excel常用函数
    VBA基础
    网站收录(1)-行业研究
    网络爬虫(11)-Scrapy分布式
    网络爬虫(10)-进程、线程
    log
    关于camera 智障的问题
  • 原文地址:https://www.cnblogs.com/shihao/p/2498645.html
Copyright © 2020-2023  润新知