Master Page in Asp.Net

To create web pages with a consistent layout you need a way to define these relatively static regions in a single template file. Versions of ASP.NET prior to 2.0 did not have a template solution so you were forced to duplicate your page layout on every single page in the website. Fortunately, this is no longer the case due to master pages.
Also, you can check out my previous posts on:
The biggest benefit of master pages is that they enable you to define the look and feel of all the pages on your site in a single location.
This means that if you want to change the layout of your site i.e, if you want to move the menu from the left to the right, you only need to modify the master page and the pages based on this master will pick up the changes automatically.
To some extent, a master page looks like a normal ASPX page. It contains static HTML such as the <html>, <head>, and <body> elements, and it can also contain other HTML and ASP.NET server controls.
A master page uses an @ Master directive that identifies the file as a master page.
<%@ Master Language=”VB” %>
<%@ Master Language=”C#” %>
The content pages, which are essentially normal ASPX files, but without the usual code you find in them like the <html>, <head>, <body>, and <form> elements, are connected to a master page using the MasterPageFile attribute of the Page directive:
<%@ Page Title=”” Language=”VB” MasterPageFile=”~/MasterPages/Test.master”
AutoEventWireup=”false” CodeFile=”Default.aspx.vb” Inherits=”_Default”>
<%@ Page Title=”” Language=”C#” MasterPageFile=”~/MasterPages/Test.master”
AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default”>
The page-specific content is then put inside a Content control that points to the relevant ContentPlaceHolder:
<asp:Content ID=”Content1″ ContentPlaceHolderID=”ContentPlaceHolder1″
A master page is useless without a content page that uses it. Generally, you’ll only have a few master pages, whereas you can have many content pages.
Check out Best Alternative to InfoPath -> Try Now


New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

(Installation & Features)

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →