zoukankan      html  css  js  c++  java
  • 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 + "\" />");
          }
       }
    }
  • 相关阅读:
    iphone备忘录存储路径
    wp7常用Task,启动器与选择器
    sql ce 修改表数据
    MessageBox.Show()中的换行
    莫名异常
    wp7中设置toolkit的工具栏图标不能正常显示(DatePicker和TimePicker)
    json 解析
    wp7弹出提示框退出程序
    第一个ios程序
    TextBox只显示数字
  • 原文地址:https://www.cnblogs.com/shihao/p/2498645.html
Copyright © 2011-2022 走看看