Event Handler Sequence
<p>I have a piece of test code in order to understand the executing sequence of event handlers. Why is the sequence like this?:</p>

<ol>
<li><code>Button1_Init</code></li>
<li><code>Page_Init</code></li>
<li><code>Page_Load</code></li>
<li><code>Button1_Load</code></li>
<li><code>Page_PreRender</code></li>
<li><code>Button1_PreRender</code></li>
<li><code>Button1_Unload</code></li>
<li><code>Page_Unload</code></li>
</ol>

<p>For example, why is <code>Button1_Init</code> before <code>Page_Init</code>, but <code>Page_Load</code> is before <code>Button1_Load</code>?</p>

<p>The test code: </p>

<pre><code>public partial class WebForm1 : System.Web.UI.Page
    {

        protected void Page_Init(object sender, EventArgs e)
        {

        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Page_PreRender(object sender, EventArgs e)
        {

        }

        protected void Page_Disposed(object sender, EventArgs e)
        {

        }

        protected void Page_Unload(object sender, EventArgs e)
        {

        }

        protected void Button1_Init(object sender, EventArgs e)
        {

        }

        protected void Button1_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_PreRender(object sender, EventArgs e)
        {

        }

        protected void Button1_Disposed(object sender, EventArgs e)
        {

        }

        protected void Button1_Unload(object sender, EventArgs e)
        {

        }
    }
</code></pre>
