Next


The Page Events / Page Life Cycle

Demo on Page Events Default.aspx.cs


public partial class _Default : System.Web.UI.Page 
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Response.Write("This is PreInit event.<br>");        
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        Response.Write("This is Init event.<br>");
    }
    protected void Page_PreLoad(object sender, EventArgs e)
    {
        Response.Write("This is PreLoad event.<br>");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("This is Load event.<br>");
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        Response.Write("This is PreRender event.<br>");
    }
    protected void Page_Unload(object sender, EventArgs e)
    {
        //Response.Write("This is Unload event.<br>"); 
        // this message never be displayed, because the web page already closed.
    }
}

                                  

Implicit Objects in ASP.NET Serer Pages

 In ASP.NET Server Pages, few objects will be created implicitly.