ASP.Net Master Pages are one of the recent features added in ASP.Net. This feature allows a user to apply same kind of page layout to all the pages of the web application or a website. A web page which uses the master page is also known as the content page. Previously, there was consistent issue faced by users regarding not to have a feature that allow users to give a consistent look across multiple web pages of a single website. ASP.Net master pages are created to take care of deficiency in .NET.
In a website, you can find number of features same across multiple web pages of a single website such as copyright notices, menus, logos etc. Also, a website has a single layout design. Sometimes, even the control buttons across the web pages remains same. In such condition, Master pages take the control to apply same features across the multiple web pages.
Usually, the master page is differentiated by @Master directive which takes place of the directive @page which is used in the pages which are not the part of master pages. The master directive looks something like below:
<%@ Master Language=”VB” %>
The directive @Master can contain almost the same directives which @Control directive can. I.e. below master page directive contains the name of the code file and allocates a class name for the master page.
<%@ Master Language=”VB” CodeFile=”MasterPageexam.masterexam.vb” Inherits=”MasterPageexam” %>
In addition to above elements, @Master directive can also contains the top level HTML elements such as head, html tag, form tag etc. for a web page. I.e. user can use the html table tag and image tag to include table and image in the web page. User is allowed to use all the elements of ASP.NET and HTML as a part of the master page. This means ASP.NET master page is a well organized feature for the ASP.NET users to have same look and feel across multiple web pages with a little effort.
For Step 5 please click here.