ASP.NET Tutorial

.NET Framework

ASP.NET Introduction

ASP.NET Web Forms

Standard Controls

Label Control

TextBox Control

Image Control

Button Controls

Redirecting User

Using HyperLinks

RadioButton Control


CheckBox Control

CheckBoxList Control


ListBox Control

ImageMap Control

Event-Driven Programming

ASP.NET Page Structure


Master Page

View State

Visibility of Controls

Formatting Controls

Applying CSS

Dynamic CSS

Using Style Class

Themes and Skins

Panel Control

PlaceHolder Control

AdRotator Control

Calendar Control

File Upload, Virtual Path

Validation Controls

Page Navigation

User Control

Separating Code-Presentation

Overview of ADO.NET

Data Binding

DataBinding List Control

ASP.NET Master Page

A Master Page enables you to share the same content among multiple pages in a website. The master page defines placeholders for the content, which can be overridden by content pages. The output result is a combination of the master page and the content page. This improves the maintainability of your site and avoids unnecessary duplication of code for shared site structure or behaviour.

Defining a Master page is similar to defining a normal page, but saving a Master page is different from saving a normal page. You must save the Master pages by using the .master file extension. Master pages are completely transparent to end users and permit developers to create Web sites where pages share a common layout. The page layout for Master Pages is easy to create, simple to maintain, and simple to assign to a Web application. The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.

Features of MasterPage

  1. The extension of MasterPage is '.master'.
  2. MasterPage cannot be directly accessed from client because it just acts as a template for the other Content Pages.
  3. In a MasterPage we can have content either inside ContentPlaceHolder or outside it. Only content inside the ContentPlaceHolder can be customized in the Content Page.
  4. We can have multiple masters in one web application.
  5. A MasterPage can have another MasterPage, MasterPage can be nested
  6. Controls of MasterPage can be programmed in the MasterPage and content page but a content page control will never be programmed in MasterPage.
  7. A master page of one web application cannot be used in another web application.
  8. The MasterPageFile property of a webform can be set dynamically and it should be done either in or before the Page_PreInit event of the WebForm. Page.MasterPageFile = "MasterPage.master". The dynamically set Master Page must have the ContentPlaceHolder whose content has been customized in the WebForm.

Updated: 29-Aug-19