Thursday, April 25, 2013

How to add other ASP.Net Page events apart from Page_Load

Dear Friends,

When we add any new ASP.Net page in solution, By default we will get Page_Load event in the code behind file. But if we want to add other Page Life Cycle events and write some logic on it, here is the way to do it.

1.  Open Solution Explorer
2.  Select the Asp page on which you want to add events
3.  Right click on page and select View Component Designer as follows


4.  Then click on the Properties or Press F4 button and click on the yellow button to get list of all page life cycle event as follows


Happy coding.....

Monday, April 15, 2013

Sequence of ASP.Net events including Application, Page and Control

Application: BeginRequest

Application: PreAuthenticateRequest

Application: AuthenticateRequest

Application: PostAuthenticateRequest

Application: PreAuthorizeRequest

Application: AuthorizeRequest

Application: PostAuthorizeRequest

Application: PreResolveRequestCache

Application: ResolveRequestCache

Application: PostResolveRequestCache

Application: PreMapRequestHandler

Page: Construct

Application: PostMapRequestHandler

Application: PreAcquireRequestState

Application: AcquireRequestState

Application: PostAcquireRequestState

Application: PreRequestHandlerExecute

Page: AddParsedSubObject

Page: CreateControlCollection

Page: AddedControl

Page: AddParsedSubObject

Page: AddedControl

Page: ResolveAdapter

Page: DeterminePostBackMode

Page: PreInit

Control: ResolveAdapter

Control: Init

Control: TrackViewState

Page: Init

Page: TrackViewState

Page: InitComplete

Page: LoadPageStateFromPersistenceMedium

Control: LoadViewState

Page: EnsureChildControls

Page: CreateChildControls

Page: PreLoad

Page: Load

Control: DataBind

Control: Load

Page: EnsureChildControls

Page: LoadComplete

Page: EnsureChildControls

Page: PreRender

Control: EnsureChildControls

Control: PreRender

Page: PreRenderComplete

Page: SaveViewState

Control: SaveViewState

Page: SaveViewState

Control: SaveViewState

Page: SavePageStateToPersistenceMedium

Page: SaveStateComplete

Page: CreateHtmlTextWriter

Page: RenderControl

Page: Render

Page: RenderChildren

Control: RenderControl

Page: VerifyRenderingInServerForm

Page: CreateHtmlTextWriter

Control: Unload

Control: Dispose

Page: Unload

Page: Dispose

Application: PostRequestHandlerExecute

Application: PreReleaseRequestState

Application: ReleaseRequestState

Application: PostReleaseRequestState

Application: PreUpdateRequestCache

Application: UpdateRequestCache

Application: PostUpdateRequestCache

Application: EndRequest

Application: PreSendRequestHeaders

Application: PreSendRequestContent