ASP.Net Page_Load and Page_LoadComplete

My application dbscript has a simple page structure for most pages: Each page related to a single record has a menu control displaying the links and actions for the current record.

For example, the Project page proj_edit.aspx embeds a proj_menu.ascx control, which retrieves some data from the database in the control’s Page_Load event.

If you want to access this data from the embedding page through the ascx control, you cannot access it in the page’s Page_Load event, as the Page_Load of the control has not yet fired. There is another event, less known (at least I did not know it), called Page_LoadComplete, which fires after each embedded control’s Page_Load has been processed.

To implement a Page_LoadComplete event in a page, you need to set


in the @Page directive of the aspx file.

Then simply add the lines

protected void Page_LoadComplete(object sender, EventArgs e)

to your page class in the aspx.cs file.

I posted about the ASP.Net page life cycle about a year ago, but recently came across this post which has a more detailed diagram on the page and control life cycle.

Download it. Memorize it. Make it your desktop background!πŸ˜‰

5 Responses to ASP.Net Page_Load and Page_LoadComplete

  1. Daniel says:

    This really helped me, thanks.

  2. Ansari says:

    useful info,


  3. Richard says:

    Yes!!! Thank you for this!!!!!!!!!!!!!!!!!!!!!

  4. […] ASP.Net Page_Load and Page_LoadComplete […]

  5. You are a freaking star!. Thanks for posting this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: