When you’ve got some existing ASP.NET pages and you later on want to add a common masterpage, do this:
Master Page
- Create a masterpage, e.g.
Management.Master. - Add the sub pages’ comon controls to the master.
- In the
Management.Master, addContentPlaceHolderitems for head and body:
Sub Page
Do the following in the subpage.aspx:
- Add masterpagefile to page level directive:
<%@ Page ... MasterPageFile="Management.Master" - Remove the
, ,and
tags.,
- Replace the
tag by thetag respecting the link to the ContentPlaceHolder via ID and ContentPlaceHolderID, like this:
// former head content goes here
-
Likewise replace the
bodytag by thetag:
// former body content goes here
Sub Page Easy
If you've got nothing than the tag inside of the section, it is a bit easier:
- Add masterpagefile and title to page level directive:
<%@ Page ... MasterPageFile="Management.Master" Title="Subpage" - Remove the
section. - Replace the
tag by thetag respecting the link to the ContentPlaceHolder via ID and ContentPlaceHolderID, like this:
// former body content goes here
Finish