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
, addContentPlaceHolder
items 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
,
- Replace the
tag by the
tag respecting the link to the ContentPlaceHolder via ID and ContentPlaceHolderID, like this:
// former head content goes here
-
Likewise replace the
body
tag by the
tag:
// 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 the
tag respecting the link to the ContentPlaceHolder via ID and ContentPlaceHolderID, like this:
// former body content goes here
Finish