zoukankan      html  css  js  c++  java
  • LifecycleControl.cs

    // Title: Building ASP.NET Server Controls
    //
    // Chapter: 5 - Event-based Programming
    // File: LifecycleControl.cs
    // Written by: Dale Michalk and Rob Cameron
    //
    // Copyright ?2003, Apress L.P.
    using System;
    using System.Web.UI;
    using System.Collections.Specialized;
    using System.Diagnostics;

    namespace ControlsBookLib.Ch05
    {
       [ToolboxData("<{0}:Lifecycle runat=server></{0}:Lifecycle>")]
       public class Lifecycle : Control, IPostBackEventHandler, IPostBackDataHandler
       {
          // Init Event
          override protected void OnInit(System.EventArgs e)
          {         
             Trace("Lifecycle: Init Event.");
             base.OnInit(e);
          }

          override protected void TrackViewState()
          {         
             Trace("Lifecycle: Track ViewState.");
             base.TrackViewState();
          }

          // Load ViewState Event
          override protected void LoadViewState(object savedState)
          {         
             Trace("Lifecycle: Load ViewState Event.");
             base.LoadViewState(savedState);
          }

          // Load Postback Data Event
          public bool LoadPostData(string postDataKey,
             NameValueCollection postCollection)
          {
             Trace("Lifecycle: Load PostBack Data Event.");

             Page.RegisterRequiresRaiseEvent(this);
             return true;
          }

          // Load Event
          override protected void OnLoad(System.EventArgs e)
          {         
             Trace("Lifecycle: Load Event.");
             base.OnLoad(e);
          }

          // Post Data Changed Event
          public void RaisePostDataChangedEvent()
          {
             Trace("Lifecycle: Post Data Changed Event.");
          }

          // Postback Event
          public void RaisePostBackEvent(string argument)
          {
             Trace("Lifecycle: PostBack Event.");
          }

          // PreRender Event
          override protected void OnPreRender(System.EventArgs e)
          {         
             Trace("Lifecycle: PreRender Event.");
             Page.RegisterRequiresPostBack(this);
             base.OnPreRender(e);
          }

          // Save ViewState
          override protected object SaveViewState()
          {
             Trace("Lifecycle: Save ViewState.");
             return base.SaveViewState();
          }

          // Render Event
          override protected void Render(HtmlTextWriter writer)
          {   
             base.Render(writer);
             Trace("Lifecycle: Render Event.");
             writer.Write("<h3>LifeCycle Control</h3>");
             
          }

          // Unload Event
          override protected void OnUnload(System.EventArgs e)
          {         
             Trace("Lifecycle: Unload Event.");
             base.OnUnload(e);
          }

          // Dispose Event
          public override void Dispose()
          {         
             Trace("Lifecycle: Dispose Event.");
             base.Dispose();
          }

          private void Trace(string info)
          {
             Context.Trace.Warn(info);
             Debug.WriteLine(info);
          }
       }
    }
  • 相关阅读:
    Resolving multicopy duplications de novo using polyploid phasing 用多倍体相位法解决多拷贝复制的新问题
    Efficient algorithms for polyploid haplotype phasing 多倍体单体型分型的有效算法
    PolyCluster: Minimum Fragment Disagreement Clustering for Polyploid Phasing 多聚类:用于多倍体的最小碎片不一致聚类
    MicroRNA in Control of Gene Expression: An Overview of Nuclear Functions 微RNA控制基因表达:核功能概述
    点9图 Android设计中如何切图.9.png
    【Android开发经验】android:windowSoftInputMode属性具体解释
    Android存储路径你了解多少?
    Android 各种路径详细说明
    自定义Dialog的详细步骤(实现自定义样式一般原理)
    Android:图解四种启动模式 及 实际应用场景解说
  • 原文地址:https://www.cnblogs.com/shihao/p/2498721.html
Copyright © 2011-2022 走看看