i

ASP.Net A Complete Guide

Web Forms Event Model

Event model consists of two things one is the event, and another is the event handler. The event handler is nothing but the function/method/subroutine which bounds to the event.

Below are the events which involve in the page life cycle

PreInit – It checks if the page is postback or not. This event is handled by the OnPreInit method or creating a Page_PreInit handler.

Init – This event is handled by overloading the OnInit method or creating a Page_Init handler. Its main purpose is to initialize the control property.

Incomplete – All the controls turn on view-state tracking.

LoadViewState – It allows loading view state data into the controls.

LoadPostData – Input field of form tag processed.

PreLoad – This event can be handled by overloading the OnPreLoad method or creating a Page_PreLoad handler. It occurs before the postback data is loaded.

Load – This event can be handled by the OnLoad method or creating a Page_Load handler. For loading page, first load event is called, and then all the child events get called.

LoadComplete – This event is handled by overloading the OnLoadComplete method or creating a Page_LoadComplete handler. This event gets called when loading of the page is completed.

PreRender – This event gets called before the output is generated for that page. Controls can perform the required updates before the output is generated..

PreRenderComplete –  This is  called when the PreRender event gets complete its action

SaveStateComplete – In this event, we can store the information of the control state and view state. The HTML script is generated.

UnLoad – the Last event in the page life cycle. It fires the UnLoad event. It is used to complete the cleanup activity.