I will be keep things here really simple. Even a person with no experience in .net should be able to follow this tutorial. I will be using Visual Studio 2012.

You can use any version. It will almost be similar to this.

Steps for creating Master Page:

Step 1: Create a new website in VS 2012

Step 2: Name the project MasterPageTutorial. See to it that you add just an empty website.

 

Step 3: Use Ctrl+shift+A to open a Add a new item dialog box. Select the Master Page option. Let it have the default name.

Step 4: Make changes in the code. Change it to the following:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

This is the main content which will be there in every page which you make using this master page 🙂


The content in this will be the defualt content that will be displayed in the content place holder by default 😉

 

 

Step 5: Similarly add a new style sheet to the website by following the step 3. Name the style sheet Style.css.Add the Following code to it.

body {
    color:black;
    background-color:beige;
}

Now add the following line in the head tag of the of the master page. Now you have successfully linked your style sheet to the masterpage.


Step 6: You are done for now. You have created your first master page.But you can not run to view it. In our next tutorial we will tell you how to add a new web form that inherits from the master page their structuring and layout. Please feel free to comment.