473,698 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Mas ter:

<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<asp:ContentPla ceHolder ID="head" runat="server">
</asp:ContentPlac eHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">

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

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

<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Aug 16 '08 #1
5 2279
You master page content within your <asp:ContentPla ceHolder...>

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**********@g mail.comwrote in message
news:96******** *************** ***********@26g 2000hsk.googleg roups.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.Mas ter:

<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<asp:ContentPla ceHolder ID="head" runat="server">
</asp:ContentPlac eHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">

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

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

<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
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.mas ter" %>

Whatever HTML or text in ContentPlaceHol der1 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**********@g mail.comwrote in message
news:96******** *************** ***********@26g 2000hsk.googleg roups.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.Mas ter:

<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<asp:ContentPla ceHolder ID="head" runat="server">
</asp:ContentPlac eHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">

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

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

<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
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...@somew here.comwrote:
Type the Master in each content page (Default.aspx):

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

Whatever HTML or text in ContentPlaceHol der1 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...@g mail.comwrote in message

news:96******** *************** ***********@26g 2000hsk.googleg roups.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.Mas ter:
<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
* *<title>Untitle d Page</title>
* *<asp:ContentPl aceHolder ID="head" runat="server">
* *</asp:ContentPlac eHolder>
</head>
<body>
* *<form id="form1" runat="server">
* *<div>
* * * *<asp:ContentPl aceHolder ID="ContentPlac eHolder1"
runat="server">
* * * * * *<p>
* * * * * * * *This is the master page</p>
* * * *</asp:ContentPlac eHolder>
* *</div>
* *</form>
</body>
</html>
And default.aspx
<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
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.WebApp lication
namespaces sounded wierd. Where do they come from?

"xlar54" <sc**********@g mail.comwrote in message
news:3e******** *************** ***********@w7g 2000hsa.googleg roups.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...@somew here.comwrote:
Type the Master in each content page (Default.aspx):

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

Whatever HTML or text in ContentPlaceHol der1 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...@g mail.comwrote in message

news:96******** *************** ***********@26g 2000hsk.googleg roups.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.Mas ter:
<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<asp:ContentPla ceHolder ID="head" runat="server">
</asp:ContentPlac eHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">
<p>
This is the master page</p>
</asp:ContentPlac eHolder>
</div>
</form>
</body>
</html>
And default.aspx
<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
runat="server">
<p>
This is default.aspx</p>
</asp:Content>
Aug 17 '08 #5
"xlar54" <sc**********@g mail.comwrote in message
news:96******** *************** ***********@26g 2000hsk.googleg roups.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.Mas ter:

<%@ Master Language="C#" AutoEventWireup ="true"
CodeBehind="Mas terPage1.master .cs"
Inherits="Regis ter.WebApplicat ion.MasterPage1 " %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<asp:ContentPla ceHolder ID="head" runat="server">
</asp:ContentPlac eHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPla ceHolder ID="ContentPlac eHolder1"
runat="server">

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

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

<%@ Page Language="C#" MasterPageFile= "~/MasterPage1.Mas ter"
AutoEventWireup ="true" CodeBehind="Def ault.aspx.cs"
Inherits="Regis ter.WebApplicat ion.Default" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHol derID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
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
2432
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 web part page? Does it take place at the page level? ...or the content area level? 3. Where is the Web Part Manager instantiated? ...in the Master Page? ....Content Page? ...elsewhere?
7
1954
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 I've created StartDate and EndDate properties, which are basically wrappers around the SelectedDates property from the Calendar control. When I select another date in the Calendar, the page updates normally, but when Page_Load for the content page...
4
1868
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, I am having problems with Freedom2.master. The first problem is I sometimes get the following error when I build the site. The type 'Freedom2' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
2
6997
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 header. I tried to put the link tag in the Master page, but the classes are not recognized in the Content Page. How do I use a StyleSheet with the Content Page? TIA
0
2103
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 sets a connection string to the database. The content page has a simple gridview that should show records from the selected database. Initial content page displays data from correct place. first change of dropdownlist correctly updates content...
4
3916
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 these two things, the page flashes everytime my textbox changes and the panel is updated. If I just use a regular textbox along with the Master Page, it works fine. If I use by user control without the Master Pages, it works fine. When I...
2
3826
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" Inherits="MyCompany.MyApp.default" Title="Untitled Page" %> The first line in MasterPage.master is the following: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MyCompany.MyApp.masterpage" %>
6
9153
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" %> On the Master Page I have a public property exposed: Public Property ErrorMessage() As String Get Return txtError.InnerText End Get
5
2712
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 file is added by the webcontrol. This prevents me having to remember to add the CSS file to the page if I use a certain webcontrol. I have a MasterPage with an array of StyleSheets, and a public function for
3
5904
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 CTMNet.master and I have tested it with no problems. I am now trying to use VS2008 to build my first application which would reference the master page. I created a virtual directory that points to c:\inetpub\wwwroot\masters, and my page starts with: ...
0
8675
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6521
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.