Event Sequence on ASP.NET page creation
Asked Answered
I

3

5

I'm looking for a good tutorial/article that explains the exact sequence of events that takes place when a page is created. I can never remember the order. I think it's something like the parent controls Init event is called, then the child controls Init event is called, in order of the placement on the page. Also, when the control events are called, what order are they called in? For example, if a button event is raised, does this event get called before a DataList_ItemDataBound event is called if the DataList.DataBind is in the Page_Load event? So, does anyone want to try to explain or direct me to a nice article that explains all this?

thanks.

Idelson answered 19/5, 2010 at 18:39 Comment(0)
C
5

This link should cover it: MSDN Page Life Cycle

Corena answered 19/5, 2010 at 18:41 Comment(1)
Also be aware of this fact, because it confuses most people (as it did me): "Master pages behave like child controls on a page: the master page Init event occurs before the page Init and Load events, and the master page Load event occurs after the page Init and Load events." (as mentioned in the MSDN page above)Plosion
L
5

Maybe you're looking for this: alt text

by Leon Andrianarivony.

Liberate answered 19/5, 2010 at 18:49 Comment(1)
Thanks for sharing, and thanks Léon for creating this nice paper.Stan
I
2

This is a good article I refer to for these types of questions.

http://www.aspfree.com/c/a/ASP.NET/ASP.NET-Life-Cycle-and-Best-Practices/

And to answer your question specifically - Button events run after everything in Page Load is completed so if you're calling a DataBind in Page_Load, the button click event comes after that.

Incurrent answered 19/5, 2010 at 18:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.