473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Master page problem

I have a very simple 2.0 website (framework), that uses a master
page...not. I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. Not sure whats wrong. Below is my code. Any help would
be appreciated. VS2008.

MasterPage1.Master:

<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>

<!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">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">

<p>
This is the master page</p>

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
And default.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Aug 16 '08 #1
5 2265
You master page content within your <asp:ContentPlaceHolder...>

It should go outside. For example, I bet the title of your content page
would change if you modified the master page title to read something other
than Untitled Page

"xlar54" <sc**********@gmail.comwrote in message
news:96**********************************@26g2000h sk.googlegroups.com...
>I have a very simple 2.0 website (framework), that uses a master
page...not. I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. Not sure whats wrong. Below is my code. Any help would
be appreciated. VS2008.

MasterPage1.Master:

<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>

<!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">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">

<p>
This is the master page</p>

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
And default.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>

Aug 17 '08 #2
Type the Master in each content page (Default.aspx):

<%@ MasterType VirtualPath="~/MasterPage1.master" %>

Whatever HTML or text in ContentPlaceHolder1 as declared in MasterPage1 will
be over-ridden by the Content2 control in the Content Page.

I would also refer to the videos at asp.net that will give you code examples
to start with. Watching as many as possible helps as each usually covers a
separate MasterPage issue.
"xlar54" <sc**********@gmail.comwrote in message
news:96**********************************@26g2000h sk.googlegroups.com...
>I have a very simple 2.0 website (framework), that uses a master
page...not. I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. Not sure whats wrong. Below is my code. Any help would
be appreciated. VS2008.

MasterPage1.Master:

<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>

<!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">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">

<p>
This is the master page</p>

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
And default.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Aug 17 '08 #3
But the odd thing is... I didnt write a single line of that code other
than the "this is the master page" and "this is default.aspx". The
rest came completely from the designer. Is Visual Studio doing
something wrong here?
On Aug 16, 8:09*pm, "HillBilly" <someb...@somewhere.comwrote:
Type the Master in each content page (Default.aspx):

<%@ MasterType VirtualPath="~/MasterPage1.master" %>

Whatever HTML or text in ContentPlaceHolder1 as declared in MasterPage1 will
be over-ridden by the Content2 control in the Content Page.

I would also refer to the videos at asp.net that will give you code examples
to start with. Watching as many as possible helps as each usually covers a
separate MasterPage issue.

"xlar54" <scott.hut...@gmail.comwrote in message

news:96**********************************@26g2000h sk.googlegroups.com...
I have a very simple 2.0 website (framework), that uses a master
page...not. *I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. *Not sure whats wrong. *Below is my code. *Any help would
be appreciated. *VS2008.
MasterPage1.Master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>
<!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">
* *</asp:ContentPlaceHolder>
</head>
<body>
* *<form id="form1" runat="server">
* *<div>
* * * *<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
* * * * * *<p>
* * * * * * * *This is the master page</p>
* * * *</asp:ContentPlaceHolder>
* *</div>
* *</form>
</body>
</html>
And default.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
* *<p>
* *This is default.aspx</p>
</asp:Content>
Aug 17 '08 #4
Not VS2008 or any other tool will ever write all the code for all of the
circumstances we might encounter. I thought the Register.WebApplication
namespaces sounded wierd. Where do they come from?

"xlar54" <sc**********@gmail.comwrote in message
news:3e**********************************@w7g2000h sa.googlegroups.com...
But the odd thing is... I didnt write a single line of that code other
than the "this is the master page" and "this is default.aspx". The
rest came completely from the designer. Is Visual Studio doing
something wrong here?
On Aug 16, 8:09 pm, "HillBilly" <someb...@somewhere.comwrote:
Type the Master in each content page (Default.aspx):

<%@ MasterType VirtualPath="~/MasterPage1.master" %>

Whatever HTML or text in ContentPlaceHolder1 as declared in MasterPage1
will
be over-ridden by the Content2 control in the Content Page.

I would also refer to the videos at asp.net that will give you code
examples
to start with. Watching as many as possible helps as each usually covers a
separate MasterPage issue.

"xlar54" <scott.hut...@gmail.comwrote in message

news:96**********************************@26g2000h sk.googlegroups.com...
I have a very simple 2.0 website (framework), that uses a master
page...not. I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. Not sure whats wrong. Below is my code. Any help would
be appreciated. VS2008.
MasterPage1.Master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>
<!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">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
<p>
This is the master page</p>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
And default.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Aug 17 '08 #5
"xlar54" <sc**********@gmail.comwrote in message
news:96**********************************@26g2000h sk.googlegroups.com...
>I have a very simple 2.0 website (framework), that uses a master
page...not. I added the default.aspx page as a webcontent form, with
the master page as it's master page, but the master page is never
displayed. Not sure whats wrong. Below is my code. Any help would
be appreciated. VS2008.

MasterPage1.Master:

<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="MasterPage1.master.cs"
Inherits="Register.WebApplication.MasterPage1" %>

<!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">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">

<p>
This is the master page</p>

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
And default.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage1.Master"
AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="Register.WebApplication.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Also, what do you mean "the master page is never displayed". It won't
Aug 18 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the...
7
by: Martijn Saly | last post by:
Hi there, I've created a master page with some controls on it, a Calendar control among others. Now depending on the date(s) selected, the content page needs to be updated. In the masterpage...
4
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However,...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
4
by: Diane Yocom | last post by:
I'm trying to use an Atlas UpdatePanel to just update a label when a text box has changed. The problem is that my textbox is in a user control and I'm using Master Pages - with the combination of...
2
by: Argirop | last post by:
I have a page Default.aspx. Its first line is the following: <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="default.aspx.cs"...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
5
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm trying to make my code as streamlined as possible, and add CSS file references dynamically when they are required, for example, if a page contains a webcontrol, then the related CSS...
3
by: =?Utf-8?B?U3RldmUgTGFGb3JnZQ==?= | last post by:
I have an intranet site and want to create a simple master page to be shared across all applications that are built for that site. I build my master page in c:\inetpub\wwwroot\Masters as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.