In the previous tutorial, you learn about making your first master Page. Master Pages are like blueprints that we will be using to generate similar copies of web pages.

So, creating master pages are just not enough. You have to add a web form that would be inheriting the layout structure from the master page you will be binding it to.

Make sure you have gone through the “Create your first Master Page” tutorial before going further.

Here is the step by step procedure of creating a master page.

Step 1: Add a new web form. Name it Default.aspx. See to it that you have checked the checkbox saying , “Select master Page

Step 2: If you have followed the previous tutorial properly then you would receive the following code in it.

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default2" %>

Step 3: Just have a close look at the ID of the content placeholders that is generated inside the source of Defult.aspx . You will see that it is named similar to what you have in the master page. Any content that you want to have a customized look in combination to the style that is applied to the master page should be placed in the content placeholders. For the time being remove the second content placeholder. See to it that the code that is in the Default.aspx matches with the code that I have place here for your reference.

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

Step 4: Open the Default.aspx file. Now in order to run the file and view the output in the browser, press ctrl+shift+F5. You should have the following output.

You must be wondering from where the second line came. When you remove a content placeholder from the page that inherits from a master page, it will by default printout the content that is placed in the content placeholder inside the master page. This is the magic of master pages. Well go ahead and do some experimenting by creating new pages and adding both the content place holders in it.

And yeah please keep commenting.