Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created February 14, 2013 13:48
Show Gist options
  • Save yetanotherchris/4952931 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4952931 to your computer and use it in GitHub Desktop.
ASP.NET event lifecycle
int count = 1;
protected override void RecreateChildControls()
{
System.Diagnostics.Debug.WriteLine(string.Format("RecreateChildControls: {0}", count++));
base.RecreateChildControls();
}
protected override void OnInit(EventArgs e)
{
System.Diagnostics.Debug.WriteLine(string.Format("OnInit: {0}", count++));
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
System.Diagnostics.Debug.WriteLine(string.Format("OnLoad: {0}", count++));
base.OnLoad(e);
}
protected override void OnPreRender(EventArgs e)
{
System.Diagnostics.Debug.WriteLine(string.Format("OnPreRender: {0}", count++));
base.OnPreRender(e);
}
public void ShowButton()
{
System.Diagnostics.Debug.WriteLine(string.Format("ShowButton: {0}", count++));
}
protected override void OnUnload(EventArgs e)
{
System.Diagnostics.Debug.WriteLine(string.Format("OnUnload: {0}", count++));
base.OnUnload(e);
}
protected override void Render(HtmlTextWriter writer)
{
System.Diagnostics.Debug.WriteLine(string.Format("Render: {0}", count++));
base.Render(writer);
}
protected override object SaveControlState()
{
System.Diagnostics.Debug.WriteLine(string.Format("SaveControlState: {0}", count++));
return base.SaveControlState();
}
protected override void LoadViewState(object savedState)
{
System.Diagnostics.Debug.WriteLine(string.Format("LoadViewState: {0}", count++));
base.LoadViewState(savedState);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment