Click here to Skip to main content
15,077,265 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="Site" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    
    <link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <div id="topContent">
            <a href="Default.aspx">Master Pages Tutorials</a>
        </div>
    
        <div id="mainContent">
            <asp:ContentPlaceHolder id="MainContent" runat="server" />
        </div>
        
        <div id="leftContent">
            <p style="text-align: center;">
                <asp:Label ID="DateDisplay" runat="server" />
            </p>
            
            <h3>Lessons</h3>       
            <ul>
                <li>TODO</li>
            </ul>

            <h3>News</h3>       
            <ul>
                <li>TODO</li>
            </ul>
        </div>
        
        <div id="footerContent">
            <img src="Images/PoweredByASPNET.gif" alt="Powered by ASP.NET!" />
        </div>
    </form>
</body>
</html>


In this page i want to open separate aspx page in content place holder
That means all the design of the master page will be same and I only make page design and call in contact place holder

I am new so plz help me and give solution
Posted
Updated 2-Jul-15 4:52am
v2

1 solution

That's not quite right - the master page doesn't call the content pages to display them. Instead, the content page defines its master page, and the content to display inside the content placeholders.

ASP.NET Master Pages - MSDN[^]
Beginner's Tutorial on Master Pages in ASP.NET[^]

ASP.NET
<%@ Page Language="C#" MasterPageFile="~/Site.master" Title="Content Page"%>

<asp:Content runat="server" ContentPlaceholderID="head">

(Header content goes here...)

</asp:Content>

<asp:Content runat="server" ContentPlaceholderID="MainContent">

(Main content goes here...)

</asp:Content>
   
Comments
satyashri 5-Jul-15 6:16am
   
Thanks for ur solution

I have aspx pages (like student master, course master)without master page and these are redirect (open) in one window or frame when I m click on specific master menu
(I use asp.net 4)
Then what ky I do plz help
Richard Deeming 6-Jul-15 9:33am
   
So you want to open specific pages in an iframe when you click on a link? You just need to set the target attribute[^] on the link to the match the id of the iframe.
satyashri 10-Jul-15 2:10am
   
Thanks it works

I want to menu panel like left side object explore in SQL server and menu generate dynamically through database
Plz help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900