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.

user204588
  • 1,613
  • 4
  • 31
  • 50

3 Answers3

5

This link should cover it: MSDN Page Life Cycle

derek
  • 4,826
  • 1
  • 23
  • 26
  • 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) – needfulthing Aug 29 '19 at 16:10
5

Maybe you're looking for this: alt text

by Leon Andrianarivony.

Oleks
  • 31,955
  • 11
  • 77
  • 132
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.

Shawn Steward
  • 6,773
  • 3
  • 24
  • 45