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 + "\" />");
          }
       }
    }
  • 相关阅读:
    工单组件增强
    一些BAPI
    实例程序
    使用BAPI一定要提交和回滚(错误)
    动态内表值导出为TXT文件
    网页常用功能
    Code Complete
    Typescript 解构 、展开
    Typescript变量声明
    TypeScript基础数据类型
  • 原文地址:https://www.cnblogs.com/shihao/p/2498645.html
Copyright © 2011-2022 走看看