-
Basic Asp.Net Life Cycle
From http://www.asp.net/general/videos/page-lifecycle-events
A bit about the order in the asp.net forms
Public Class _Default
Inherits System.Web.UI.Page
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
'if ths post is a postback we can check the IsPostback property
'if this is a Postback the user controls hasn't been reconstituted from the viewstate yet
'set things that are global to the page
'dynamicly set a master page or a theme property , desision based on a geography or a time
'profile property
'dynamicly added controls by a logic
End Sub
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'rewrite any specific control properties
End Sub
Private Sub Page_InitComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.InitComplete
'after all of the initialazation took place
'logic that depends on the controls initialized
End Sub
Private Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
'pre loads for all of the controls are being fired
'after this viewstate is being initialized
'all of the post back data is being initialized from the postback
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'any child control event implemented is being fired
End Sub
Private Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
'any task that requires all of the controls on the page to be loaded and validated
End Sub
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
'final changes to controls before its becoming the html
End Sub
Private Sub Page_SaveStateComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete
'viewstate has been saved
'won't be rendered to the page
'can apply some logic that requires the viewstate to be completed
End Sub
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
'been rendered
'final cleanups
'after proccessing
'close any files
'release any db connecions
End Sub
End Class
Subscribe to:
Post Comments (Atom)
0 comments: