0% found this document useful (0 votes)
265 views10 pages

Nesting Master Pages

The document discusses nested master pages in ASP.NET. It provides an example of a parent master page that contains common elements like a banner and navigation. It then shows how to create a child master page for a specific department that inherits from the parent master page and can add additional department-specific content. The child master page example includes two content placeholders that are filled by content pages. The last section briefly discusses site navigation controls in ASP.NET that allow defining a site map to provide navigation across a website.

Uploaded by

SS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
265 views10 pages

Nesting Master Pages

The document discusses nested master pages in ASP.NET. It provides an example of a parent master page that contains common elements like a banner and navigation. It then shows how to create a child master page for a specific department that inherits from the parent master page and can add additional department-specific content. The child master page example includes two content placeholders that are filled by content pages. The last section briefly discusses site navigation controls in ASP.NET that allow defining a site map to provide navigation across a website.

Uploaded by

SS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

By: Sarah Shaikh

Asst. Professor
IT/CS

Nested master pages


You can create a Master page that is nested inside

another master page


For example, you could create a parent master page
that has a company banner at the top and site
navigation controls in a side column.
You could then create a child master page for a specific
department or product that uses the parent master
page. It could also act as a master page for all other
related department or product pages.

Nested master pages


Parent.master

<% @ Master Language="C#" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>Untitled Page</title>
</head> <body>
<form id="Form1" runat="server">
<div>
<h1>Parent Master</h1>
<p style="font:color=red">This is parent master content.</p>
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>
</form>
</body>
</html>

Nested master pages


Child.master

<%@ Master Language="C#" asterPageFile="~/Parent.master"%>


<asp:Content id="Content1" ContentPlaceholderID="MainContent"
runat="server">
<asp:panel runat="server" id="panelMain" backcolor="lightyellow"> <h2>Child
master</h2>
<asp:panel runat="server" id="panel1" backcolor="lightblue">
<p>This is child master content.</p>
<asp:ContentPlaceHolder ID="ChildContent1" runat="server" /> </asp:panel>
<asp:panel runat="server" id="panel2" backcolor="pink">
<p>This is child master content.</p>
<asp:ContentPlaceHolder ID="ChildContent2" runat="server" /> </asp:panel>
<br />
</asp:panel>
</asp:Content>

Nested master pages


Content page

<%@ Page Language="C#"


MasterPageFile="~/Child.master"%>
<asp:Content id="Content1"
ContentPlaceholderID="ChildContent1" runat="server">
<asp:Label runat="server" id="Label1" text="Child label1"
font-bold="true" /> <br />
</asp:Content>
<asp:Content id="Content2"
ContentPlaceholderID="ChildContent2" runat="server">
<asp:Label runat="server" id="Label2" text="Child label2"
font-bold="true"/>
</asp:Content>

SITE NAVIGATION CONTROLS


A website is a collection of web pages. The information

that needs to be shared by the website is contained in


these web pages.
Therefore, these web pages should be linked in such a
manner that a user can easily move to the desired page
Moving between Web pages on a website is known as
navigation.
To provide a smooth navigation on a website, you need
to provide a path that can direct a user to any part or
Web page on the website. This path is known as
navigation path.

ASP.Net provides site navigation feature that provides

a consistent way to navigate a website.


This feature enables u to store the structure of your
website at a central location.
This structure contains the links to all the web pages
on your website and is known as a site map
This sitemap contains links to all web pages in website
The sitemap can be rendered on each page by using
controls such as TreeView, SiteMapPath or Menu.

Defining a site Map

You might also like