Partial Class PageFlow
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblInfo.Text &= "Page.Load event handled.
"
If Page.IsPostBack Then
lblInfo.Text &= "This is the second time you've seen this page.
"
End If
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
lblInfo.Text &= "Page.Init event handled.
"
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
lblInfo.Text &= "Page.PreRender event handled.
"
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs)
'this text never appears because the html is already rendered for the page at this point
lblInfo.Text &= "Page.Unload event handled.
"
End Sub
End Class
Partial Class MyControls
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'start examining all the controls.
DisplayControl(Page.Controls, 0)
'add the closing horizontal line
Response.Write("
")
End Sub
Private Sub DisplayControl(ByVal controls As ControlCollection, ByVal depth As Integer)
For Each cControl As Control In controls
'use the depth parameter to indent the control tree.
Response.Write(New String("-"c, depth * 4) & "> ")
'display this control
Response.Write(cControl.GetType().ToString() & " - " _
& cControl.ID & "
")
If cControl.Controls IsNot Nothing Then
DisplayControl(cControl.Controls, depth + 1)
End If
Next
End Sub
End Class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment