Programming Microsoft ASP.NET 4 - Dino Esposito [103]
StyleSheetTheme
Gets or sets the name of the style sheet applied to this page.
Theme
Gets and sets the theme for the page. Note that themes can be programmatically set only in the PreInit event.
Title
Gets or sets the title for the page.
TraceEnabled
Toggles page tracing on and off.
TraceModeValue
Gets or sets the trace mode.
UniqueID
Always returns the empty string.
ViewStateEncryptionMode
Indicates if and how the view state should be encrypted.
ViewStateMode
Enables the view state for an individual control even if the view state is disabled for the page. This property requires ASP.NET 4.
Visible
Indicates whether ASP.NET has to render the page. If you set Visible to false, ASP.NET doesn’t generate any HTML code for the page. When Visible is false, only the text explicitly written using Response.Write hits the client.
The three ID properties (ID, ClientID, and UniqueID) always return the empty string from a Page object. They make sense only for server controls.
Methods of the Page Class
The whole range of Page methods can be classified in a few categories based on the tasks each method accomplishes. A few methods are involved with the generation of the markup for the page; others are helper methods to build the page and manage the constituent controls. Finally, a third group collects all the methods related to client-side scripting.
Rendering Methods
Table 5-11 details the methods that are directly or indirectly involved with the generation of the markup code.
Table 5-11. Methods for Markup Generation
Method
Description
DataBind
Binds all the data-bound controls contained in the page to their data sources. The DataBind method doesn’t generate code itself but prepares the ground for the forthcoming rendering.
RenderControl
Outputs the HTML text for the page, including tracing information if tracing is enabled.
VerifyRenderingInServerForm
Controls call this method when they render to ensure that they are included in the body of a server form. The method does not return a value, but it throws an exception in case of error.
In an ASP.NET page, no control can be placed outside a