master page concept to display the college information

PHOTO EMBED

Wed Oct 29 2025 18:51:14 GMT+0000 (Coordinated Universal Time)

Saved by @final

๐Ÿงพ Program: Develop an ASP.NET Web Application using the Master Page Concept to Display College Information
๐Ÿชœ Step 1: Create a New Project

Open Visual Studio.

Go to File โ†’ New โ†’ Project.

Select ASP.NET Web Application (.NET Framework).

Enter the project name (e.g., CollegeInfoSite).

Choose the Empty template.

Click Create.

๐Ÿชœ Step 2: Add a Master Page

In Solution Explorer, right-click on the project โ†’
Add โ†’ New Item โ†’ Web Form Master Page.

Name it as Site1.master.

Click Add.

This page acts as a layout template for all content pages.

๐Ÿชœ Step 3: Add Design Elements to the Master Page

Open Site1.master.

Add a Header, Navigation Menu, and Footer as per your layout.

To add styling:

Right-click the project โ†’ Add โ†’ New Item โ†’ Style Sheet.

Name it Style.css and design the layout using CSS.

Link the CSS file inside <head> using:

<link href="Style.css" rel="stylesheet" />

๐Ÿชœ Step 4: Add Images

In Solution Explorer, right-click the project โ†’ Add โ†’ New Folder.

Name the folder Images.

Right-click Images โ†’ Add โ†’ Existing Item, and select images from your computer.

In the Master Page, drag an Image control from Toolbox โ†’ set:

ImageUrl = "~/Images/college.jpg"

๐Ÿชœ Step 5: Add Content Pages

In Solution Explorer, right-click the project โ†’
Add โ†’ New Item โ†’ Web Form with Master Page.

Name it Home.aspx.

Choose Site1.master as the master page.

Repeat the same to add other content pages such as:

About.aspx

Departments.aspx

Contact.aspx

๐Ÿชœ Step 6: Add Navigation Menu

Open Site1.master.

From Toolbox โ†’ Navigation, drag a Menu or HyperLink control.

Set navigation URLs for each content page:

<asp:HyperLink ID="HomeLink" runat="server" NavigateUrl="~/Home.aspx" Text="Home" />
<asp:HyperLink ID="AboutLink" runat="server" NavigateUrl="~/About.aspx" Text="About" />
<asp:HyperLink ID="DeptLink" runat="server" NavigateUrl="~/Departments.aspx" Text="Departments" />
<asp:HyperLink ID="ContactLink" runat="server" NavigateUrl="~/Contact.aspx" Text="Contact" />

๐Ÿชœ Step 7: Add Content to Pages

Open each content page (Home.aspx, About.aspx, etc.).

Add college-related content inside the <asp:Content> tag, for example:

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Welcome to ABC College</h2>
    <p>ABC College is a premier institution offering quality education...</p>
</asp:Content>

๐Ÿชœ Step 8: Test the Application

Set Home.aspx as the start page.

Press F5 (Run).

The browser displays the Master Page layout with linked content pages and navigation menu.

โœ… Output

Header: Displays College Logo and Title

Navigation Menu: Links to Home, About, Departments, Contact

Main Section: Displays content from individual pages

Footer: Shows contact or copyright information







site1.master:<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="master.Site1" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div>
 <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
     <h1>CVR COLLEGE OF ENGINEERING</h1>
                <asp:Menu ID="Menu1" runat="server">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/home.aspx" Text="home" Value="home"></asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/stuent.aspx" Text="student" Value="student"></asp:MenuItem>
                    </Items>
                </asp:Menu>
            </asp:ContentPlaceHolder>
        </div>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/images/13-1.jpg" />
    </form>
</body>
</html>
home.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="master.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <p>hooooooooo</p>
</asp:Content>

student.aspx:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="stuent.aspx.cs" Inherits="master.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <p> hiiiiiiii</p>
</asp:Content>
content_copyCOPY