Master pages provide templates for other pages with shared layout and functionality. They allow creating a consistent look and behavior for all the pages or group of pages in then application. The master page defines placeholders for the content, which can be overridden by content pages.
The pages contain the content to display.
Events and properties
The load event is triggered at the first time when a page, master page is being loaded, and then the event is triggered after every user interaction.
The PreLoad command is triggered before the first-time load event is called, and every user method interaction.
Gets a value that indicates whether this instance is post-back. When a page is rendered the first time, the value is false and then the value keeps until the page is disposed.
Gets the value indicating whether this instance is form.
Gets the parent control (master page) where page is contained.
Original example
Html Master Page
The @Master directive defines it as a master page.
The master page contains a placeholder tag <asp:ContentPlaceHolder> for individual content.
The id="Content1" attribute identifies the placeholder, allowing many placeholders in the same master page.
The @Page directive defines it as a standard content page.
The content page contains a content tag <asp:Content> with a reference to the master page (ContentPlaceHolderId=" Content1").
Class Master Page
Mater Page extends from System.Web.UI.MasterPage.
This page extends from System.Web.UI.Page.
Converted Page Sample
Converted code generates four files:
Page cs file extends from Mobilize.Web.UI.Page.
The MasterPage html file contains an additional div element, which doesn’t exist in Page html file.
TypeScript file
The ts file are generated same way for MasterPage and pages.
Additionally, a css file is generated.
When a Web Forms page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring, and maintaining state, running event handler code, and rendering.
Diagram
Description automatically generated