
Comments/Troubleshooting | 245
Page Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Page object specifically to access its members. For example, to access the
Session property of the
Page class, you can use either:
Dim oSess As HttpSessionState = Page.Session
or:
Dim oSess As HttpSessionState = Session
In addition to representing the Web Form, the Page object is the container for all
controls hosted by the page. All child controls on the page can be accessed
through the Page object’s Controls collection, which returns a ControlCollection
object. For example, the following code iterates the ControlCollection collection
and lists the name of each control:
Private Sub Page_Load(o As Object, e AS EventArgs)
Dim ctl As Control
For each ctl in Controls
Response.Write(TypeName(ctl) & ": " & ctl.ID & "<BR />")
Next
End Sub
Table 12-1 lists the properties, collections, and methods exposed by the Page class
that are documented in this chapter.
Comments/Troubleshooting
The ASP.NET equivalents of most classic ASP intrinsic objects are returned by
properties of the ASP.NET
Page class. These properties are shown in Table 12-2.
Table 12-1. Page class summary
Properties Collections Methods Events
Application Controls DataBind Error
Cache Validators FindControl Init
ClientTarget HasControls Load
Context LoadControl Unload
EnableViewState MapPath
ErrorPage ...