473,396 Members | 1,929 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,396 software developers and data experts.

Specifying masterpage in web.config?

Hi,

WHen I specify my master page in the page's @Page directive, no problems.
However, when I put it ias an attribute in Web.config's page element, the
designer fails. It just says "Error Creating Control - Content. Content
controsl can only be used in a content page." I know that there's an issue w/
nested masters, but I'm only trying to use one. Interestingly, if I run the
site, it builds and displays properly despite this error. Any thoughts on
this?

-Ben
Dec 23 '06 #1
6 6152
Forgot to mention: This is with VS2005 SP1.

-Ben

"Ben R." wrote:
Hi,

WHen I specify my master page in the page's @Page directive, no problems.
However, when I put it ias an attribute in Web.config's page element, the
designer fails. It just says "Error Creating Control - Content. Content
controsl can only be used in a content page." I know that there's an issue w/
nested masters, but I'm only trying to use one. Interestingly, if I run the
site, it builds and displays properly despite this error. Any thoughts on
this?

-Ben
Dec 23 '06 #2
Hi Ben,

Can you show us how you specify the pages element in web.config? I have a
test project and its web.config is like:

<pages masterPageFile ="~/MasterPage.master" ></pages>
And the content page are:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</asp:Content>
And the master page:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>
</head>
<body>
<form id="form1" runat="server">

<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>

</div>
</form>
</body>
</html>

It seems this work well on my side, is there any difference from your
application?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 25 '06 #3
Hi Luke,

That's odd. The only difference I spotted was that I was using VB.NET, but I
tried again with C# and got the same result.

Here is the relevant section of my web.config:

<system.web>
<pages masterPageFile="~\MasterPage.master"></pages>

And MasterPage.master:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
Nav<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
Nav</div>
</form>
</body>
</html>
And Default2.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
Test
</asp:Content>

As I stated, when I hit F5, the page displays properly in the browser as
expected with the master page, but in the VS IDE when I'm in design mide, I
get:

Error 1 Content:Content controls can only be used in a content
page. C:\Users\Ben\Desktop\WebSite1\Default2.aspx C:\...\WebSite1\

Can you confirm that you can work in the page in design view and not only
source view?

Thanks for your help...

-Ben

"Luke Zhang [MSFT]" wrote:
Hi Ben,

Can you show us how you specify the pages element in web.config? I have a
test project and its web.config is like:

<pages masterPageFile ="~/MasterPage.master" ></pages>
And the content page are:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

</asp:Content>
And the master page:

<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>
</head>
<body>
<form id="form1" runat="server">

<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>

</div>
</form>
</body>
</html>

It seems this work well on my side, is there any difference from your
application?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 26 '06 #4
Hi Ben,

All work fine on my side with same code. Have you installed VS 2005 sp1? Or
have you tried this in a new project?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 28 '06 #5
Yes, it only have limited support for master page. But for some simple
master page like the sample I can provide, it suppose to work yet. Did it
still said: "Error Creating Control - Content. Content controsl can only
be used in a content page." ?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 29 '06 #6
Hello,

This may depends on the actual enviroment, for example, the software and
add-ins installed with VS.NET. So we had better not rely on the design-time
editing for master page.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 5 '07 #7

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

Similar topics

4
by: Alexander Widera | last post by:
Hi, it is possible to set the browser dependent masterpage in the web.config, and how? in the page attributes it is an easy way, but in the web.config? In the page-tag it would look like...
0
by: Adam Tibi | last post by:
Hi, I'm using VS 2005. Using multiple MasterPages. When I try to load a page that has a Content pointing to a ContentPlaceHolderID that does not exist in the loading MasterPage an error will...
2
by: Brian Orrell | last post by:
I have set the masterPageFile property in my web.config as follows: <pages masterPageFile="~/Main.master" > When I create a webform and I don't specify a masterPageFile in the aspx (so that it...
3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
2
by: dgk | last post by:
I have an image in the masterpage which works fine everywhere except the login page. I have the login control on a page (login.aspx naturally) and the user is directed to it via forms...
4
by: cevans | last post by:
Is there a way to load a MasterPage programmatically? Not switch a page's masterpage but to create a MasterPage object that holds a given masterpage. So I know I can do: MasterPage master =...
3
by: =?Utf-8?B?U2FuZHBvaW50R3V5?= | last post by:
I have a masterpage named MasterpageController with a menu. In the codebehind I have a method SetMasterMenu(<some parms>) to display the appropriate menu items. The content page, which has a...
4
by: Christiano Donke | last post by:
Hello... I have this UserControl (login.ascx -Login), that is placed in a Masterpage (Layout.master -Layout). How can I call a sub (RedrawMenu) that is place in the code-behind of the master...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
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,...

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.