Page Life Cycle Between Content Page (ASPX Page) and User Control in ASP.Net

Here I would like to introduce the page life cycle between ASPX page and User Control. And it is very important that ASP.Net developers to be familiar with this.

We have an ASPX page that contains a User Control.

I was trying to find the sequence of events between ASPX page and User Control. The following is the diagram that helps us to understand the sequence of events between ASPX page and User Control.

Consider the cycle below in a clockwise direction that starts from Preinit of the ASPX page and completes at the unload of the ASPX page.

ASP.NET-Life-Cycle.jpg

The following are the outcomes of the diagram above:

  1. First Preinit of ASPX is called.
  2. The User Control does not have a Preinit event.
  3. The Unload of the Usercontrol is called before the Unload of the ASPX page.

Behavior of Master Page is like User Control

When I tried to find the sequence of events between a Master Page and ASPX Page I found the same sequence of events as I explained above.

We often get confused bhy the belief that a Master Page is also a Parent Page, but this is not true.

I was trying to find the sequence of events between a Master Page and an ASPX Page (and a User Control and an ASPX page),

Then I discovered that the sequence of events are the same in both cases.

For more details

Reason for Master Page to Behave like a Usercontrol in ASP.Net

MSDN link

Events in ASP.NET Master and Content Page


Similar Articles