Page Events in ASP.Net 2.0
Author: DevASP
Download Source Code : 438_ASPNetPageEvents.zip
In this article I will try to explain you when and which page event occur in ASP.Net 2.0 and how you can get the more understandability of these events flows.
When we talk about the ASP.Net 1.0/1.1 we find total of the nine events that are:
- AbortTransaction.
- CommitTransaction
- DataBinding
- Dispose
- Error
- Init
- Load
- PreRender
- Unload
Beside these page events ASP.Net 2.0 come with more new events that provide more help to developers in handling ASP.Net page. The flow of theses events with very brief code is discussed below:
Note: Here I will not discuss all these events only the main events that usually come in ASP.Net page lifecycle.
First of all declare a global StringBuilder variable; I use the string builder variable because I want to save my string against each event. Now start adding events on your page. First event that is called is Pre_Init event:
- Now the Init event is called:
- After the Init event InitComplete event is called:
- When the Initialization is complete page PreLoad event is called:
- When the PreLoad is complete the Page_load event is called. You will be quite fimiliar about these events:
- When the page is completely loaded the LoadComplete event is called:
- After the Complete load of the page the page pre rendring event is called:
- Once the render is complete PreRenderComplete is called:
- After the completion of all the events the Page_Unload event is called notice you will not see this event because it is called at the end of the page.
You can check the flow of these events by turning on the tracing.