Custom Controls ASP.Net Tutorial

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace myControls
{
    public class CustomTextBox : WebControl, IPostBackDataHandler
    {
        public event EventHandler TextChanged;
        public string Text        {
            get
            {
                if (ViewState["Text"] == null)
                    return String.Empty;
                else
                    return (string)ViewState["Text"];
            }
            set { ViewState["Text"] = value; }
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            writer.AddAttribute(HtmlTextWriterAttribute.Value, Text);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
            base.AddAttributesToRender(writer);
        }
        protected override HtmlTextWriterTag TagKey
        {
            get
            {
                return HtmlTextWriterTag.Input;
            }
        }
        public bool LoadPostData(string postDataKey, System.Collections. Specialized.NameValueCollection postCollection)
        {
            if (postCollection[postDataKey] != Text)
            {
                Text = postCollection[postDataKey];
                return true;
            }
            return false;
        }
        public void RaisePostDataChangedEvent()
        {
            if (TextChanged != null)
                TextChanged(this, EventArgs.Empty);
        }
    }
}
File: Default.aspx
<%@ Page Language="C#" %>
<%@ Register TagPrefix="custom" Namespace="myControls" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    protected void CustomTextBox1_TextChanged(object sender, EventArgs e)
    {
        lblResults.Text = CustomTextBox1.Text;
    }



    Show CustomTextBox


    
    

            id="CustomTextBox1"
        OnTextChanged="CustomTextBox1_TextChanged"
        Runat="server" />
            Text="Submit"
        Runat="server" />
    
            id="lblResults"
        Runat="server" />