Master Page, User Control, Custom Control and Content page : Order of page life cycle event

As we all know that while serving an asp.net request goes through many stages before it gets served. One of the important stages is, going through the page life cycle events. As a page can contain many other controls like User Control, Custom control etc and it can be a combination of master and content pages as well. As each control has its own life cycle so if they are inter weaved then it becomes very important to understand that how each event fits in complete lifecycle . Also this is one of the most asked question in asp.net interviews so I thought of explaining it.

Technically, Master page is nothing but a normal user control so you can treat it as user control used on a page and we will consider it same in our post. So we can say that there are two type of controls – User Control and Custom Control in a page. Content page is also nothing but a normal aspx page. Now to understand the order of events where all of these controls are available, lets first understand of the life cycle of each components individually.

Order

Note- I have not included all the events of life cycle only those are relevant at important to explain the topic. Continue reading

Advertisements