ASP.Net Master Page’s application allows us to create a consistent layout of the UI. We can create a master page in asp.net application; moreover can create multiple content pages where ever we can display content.
Master page has a extension with .Master
In above page directive we are calling master page from content page in asp.net.
Content page contains no markup outside the Content control in asp.net. There is a great flexibility in asp.net that we can create multiple master pages to provide different layouts for our application, we can create multiple content pages of each master page in asp.net. With Master and content pages we can provide more flexibility to our application, so we can make required modifications in our layout in the middle of development with spending few times.
Step 1: Add Master page, right click in project property, and then click on Add new Item, now you will see Installed Template where you can select Master Page, finally click on OK.
Step 2: Now you can right click on Master Page (TCSite.Master), and then click Add Content Page.
Step 3: Finally, you can see final view of Content Page.
Master page has a extension with .Master
Master Page Directive:
<%@ Master
Language="C#"
AutoEventWireup="true"
CodeBehind="TCSite.master.cs"
Inherits="slnTCMasterContentPage.TCSite"
%>
Content Page Directive:
<%@ Page
Title=""
Language="C#"
MasterPageFile="~/TCSite.Master"
AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs"
Inherits="slnTCMasterContentPage.WebForm1"
%>
In above page directive we are calling master page from content page in asp.net.
Content page contains no markup outside the Content control in asp.net. There is a great flexibility in asp.net that we can create multiple master pages to provide different layouts for our application, we can create multiple content pages of each master page in asp.net. With Master and content pages we can provide more flexibility to our application, so we can make required modifications in our layout in the middle of development with spending few times.
Step 1: Add Master page, right click in project property, and then click on Add new Item, now you will see Installed Template where you can select Master Page, finally click on OK.
Step 2: Now you can right click on Master Page (TCSite.Master), and then click Add Content Page.
Step 3: Finally, you can see final view of Content Page.
Download Sample in Zip:
ASP.Net Interview Questions:
- What is the difference between a mutable and immutable string in C#
- 3 Tier Architecture in asp.net
- What is the difference between an interface and abstract class
- MVC vs Webforms
Post A Comment:
0 comments: