0% found this document useful (0 votes)
15 views4 pages

Yug PR of Aspnet 4

Uploaded by

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

Yug PR of Aspnet 4

Uploaded by

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

ITM(SLS) BARODA UNIVERSITY

DEPARTMENT OF COMPUTER SCIENCE, ENGINEERING AND TECHNOLOGY


Diploma Sem – 5(A)

ASP.Net
PRACTICAL:- 4
Aim:- Create a simple web application to illustrate the concept of nesting master page
in ASP.NET

Theory:- Master pages can be nested, with one master page referencing another as its
master. Nested master pages allow you to create componentized master pages.

 A nested page template is a page template that is based on an existing page template
(also known as the root template). Nested page templates give you more flexibility
in Web sites that have both static pages and dynamic pages.

style.css Code:-
/* General Styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
}
/* Header Styles */
header {
background-color: #007bff;
color: white;
padding: 20px 0;
text-align: center;
}
header h1 {
margin: 0;
font-size: 2em;
}
/* Navigation Styles */
nav {
background-color: #0056b3;
}
nav ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
justify-content: center;
}
nav ul li {
margin: 0;
}
nav ul li a {
display: block;
padding: 15px 20px;
color: white;
text-decoration: none;
transition: background-color0.3s;
}
nav ul li a:hover {
background-color: #003d7a;
}

Name:- YUG PANCHAL Enrollment No:- 22C11066 1


ITM(SLS) BARODA UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE, ENGINEERING AND TECHNOLOGY
Diploma Sem – 5(A)

ASP.Net

/* Main Content Styles */


form {
padding: 20px;
}
.container {
max-width: 960px;
margin: 20px auto;
background-color: white;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 20px;
}
h2 {
border-bottom: 2px solid #007bff;
padding-bottom: 10px;
}
/* Footer Styles */
footer {
background-color: #007bff;
color: white;
text-align: center;
padding: 10px 0;
position: fixed;
bottom: 0;
width: 100%;
}

Site.Master Code:-
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs"
Inherits="NestedMasterPageDemo.Site" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Site Master</title>
<link href="Styles/style.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<div>
<header>
<h1>My Website(Grand Father)</h1>
<nav>
<ul>
<li><a href="Default.aspx">Home</a></li>
<li><a href="About.aspx">About</a></li>
</ul>
</nav>
</header>
<asp:ContentPlaceHolder id="MainContent" runat="server">
</asp:ContentPlaceHolder>
<footer>
<p>&copy; 2024 My Website</p>
</footer>
</div>
</form>
</body> </html>

Name:- YUG PANCHAL Enrollment No:- 22C11066 2


ITM(SLS) BARODA UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE, ENGINEERING AND TECHNOLOGY
Diploma Sem – 5(A)

ASP.Net

Nested.Master Code:-

<%@ Master Language="C#"


MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="Nested.master.cs"
Inherits="NestedMasterPageDemo.Nested" %>

<asp:Content ID="Content1"
ContentPlaceHolderID="MainContent" runat="server">
<h2>Nested Master Page Content (Father)</h2>
<asp:ContentPlaceHolder ID="NestedContent"
runat="server">
</asp:ContentPlaceHolder>
</asp:Content>

Default.aspx Code:-

<%@ Page Title="" Language="C#"


MasterPageFile="~/Nested.Master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs"
Inherits="NestedMasterPageDemo.Default" %>
<asp:Content ID="Content1"
ContentPlaceHolderID="NestedContent" runat="server">

<h3>Welcome to the Home Page (Son)</h3>


<p>This is the content of the Home page that give details about
the products on our websites.</p>

</asp:Content>

About.aspx Code:-

<%@ Page Title="" Language="C#" MasterPageFile="~/Nested.Master"


AutoEventWireup="true" CodeBehind="About.aspx.cs"
Inherits="NestedMasterPageDemo.About" %>
<asp:Content ID="Content1" ContentPlaceHolderID="NestedContent" runat="server">

<h3>Welcome to the About Page (Son)</h3>


<p>This is the content of the About page so that you can contact to us for further details.</p>

<p>Contact me: [email protected]</p>


</asp:Content>

Name:- YUG PANCHAL Enrollment No:- 22C11066 3


ITM(SLS) BARODA UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE, ENGINEERING AND TECHNOLOGY
Diploma Sem – 5(A)

ASP.Net
Output:- Header(Home) section:-

Header(About) section:-

Conclusion:- In this Practical we have learn to make an header and footer section and we
add some sections like (Father & Son) so that we can add some details of a website with
the help of Nested Master Page in Visual Studio Community.

Name:- YUG PANCHAL Enrollment No:- 22C11066 4

You might also like