Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net: what's the page life cycle order of a control/page compared to a user contorl inside it?

I have an aspx and inside it an ascx. From a short testing I see the PageLoad of the aspx is called before the PageLoad of the user-Control but the opposite is true for OnInit.

Does someone know what is the order of the events (page compared to a user-control inside it)

Thanks

like image 478
Elad Benda Avatar asked Sep 07 '11 13:09

Elad Benda


People also ask

What is the sequence of execution of the ASP.NET page life cycle?

When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering.

Which page occurs before the page life cycle begin?

1. Page Request. Page Request is the first step of the page life cycle. When a user request is made, then the server checks the request and compiles the pages.

Which of the following is the first event of ASP.NET page life cycle?

Following are the page life cycle events: PreInit - PreInit is the first event in page life cycle. It checks the IsPostBack property and determines whether the page is a postback. It sets the themes and master pages, creates dynamic controls, and gets and sets profile property values.

What is the list of events in page life cycle?

In ASP.NET, a web page has execution lifecycle that includes various phases. These phases include initialization, instantiation, restoring and maintaining state etc. it is required to understand the page lifecycle so that we can put custom code at any stage to perform our business logic.


2 Answers

You should look at this ASP.NET Page Life Cycle Overview and this

Page: PreInit
Control: Init
Page: Init
Page: InitComplete
Page: PreLoad
Page: Load
Control: Load
Page: LoadComplete
Page: PreRender
Control: PreRender
Page: PreRenderComplete
Page: SaveStateComplete
Page: RenderControl
Page: Render
Control: RenderControl
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose

like image 178
krolik Avatar answered Oct 14 '22 06:10

krolik


below link has more information

http://weblogs.asp.net/ricardoperes/archive/2009/03/08/asp-net-page-events-lifecycle.aspx

like image 34
chamara iresh Avatar answered Oct 14 '22 07:10

chamara iresh