Content controls have to be top-level controls in a content page or a nested master page that references a master page.

Why in the world am I getting this error?

The solutions I have seen either don't apply or don't work.

 Here is my master page code:

<%@ Master Language="C#" AutoEventWireup="false" CodeFile="TechLMSMasters/MainSide.master.cs" Inherits="MainSide" %>

<%@ Register TagPrefix="usercontrol" TagName="Search" Src="~/library/uc/Search.ascx" %>

<%@ Register TagPrefix="usercontrol" TagName="UserName" Src="~/library/uc/UserNameDisplay.ascx" %>

<!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">

<DIV class="user" id="userName" runat="server"><usercontrol:username id="userNameDsp" runat="server"></usercontrol:username></DIV>

<DIV class="search" id="search" runat="server"><usercontrol:search id="pageSearch" runat="server"></usercontrol:search></DIV>

<DIV class="sidebar" id="sideBar" runat="server">

<p><asp:label id="sideMenu" Runat="server"></asp:label></p>

<p align="center"><asp:image id="imgSideBar" runat="server"></asp:image></p>

</DIV>

</asp:ContentPlaceHolder>

</div>

</form>

</body>

</html>

Here is my declarative in another page the uses this master page:

<%@ Page language="c#" MasterPageFile="~/TechLMSMasters/MainSide.master" Inherits="GoodyearLMS.Records.TreeView" CodeFile="TreeView.aspx.cs" %>

It is the top line in my TReeview page.  I created a virtual directory in IIS for "C:\TechLMS\TechLMSMasters" that holds my master pages.

Alex

 

0
OldeEnglishD
2/21/2008 4:27:03 PM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

2 Replies
3273 Views

Similar Articles

[PageSpeed] 52

Do you have any ContentPlaceHolder's is your UserControls or nested withing your ContentPlaceHolder's? 

0
Adam
2/21/2008 5:38:48 PM

 No, I don't

0
OldeEnglishD
2/21/2008 6:52:25 PM
Reply:

Similar Artilces:

Error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.
when I make a directory on my root, and in that directory I put a masterpage and a web form ... I get always an error : Content controls have to be top-level controls in a content page or a nested master page that references a master page.   Does somebody know what the problem is ? Is it possible you can't set a masterpage in a directory ... ?Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) i've founded ... I had to nest my masterpage ...Kind Regards,Joeri Pansaerts.From Bruges, Belgium :) Hi Joeri Pansaerts, I am receiving the same error as the one posted her...

ERROR Content controls have to be top-level controls in a content page or a nested master page that references a master page.
This all used to work until about 5 minutes ago. Did I change something? For some reason I am now getting this error: Content controls have to be top-level controls in a content page or a nested master page that references a master page. What I have:  I have a masterpage inside of a directory. That directory is a first level directory with its own web.config file....The whole thing is protected by the web.config file above it (in the main public directory). That main public directory has a masterpage as well. I am not currently linking the two masterpages together becuase...

Content controls are allowed only in content page that references a master page.
HiI'm getting the above error with my application.Basically I had a master file and then some page files referencing the master file.In the page files I had some ajax controls so had :<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><atlas:ScriptManager ID="ScriptManager1" runat="server"></atlas:ScriptManager>in them.but when I try adding an ajax control to the master file and putting the above code in, it shows the error messagewhy would this be?thanks!  Make sure you have prop...

Error:Content controls are allowed only in content page that references a master page?!!
 Hello All I have a web application, it is working well in localost without any error but when I upload it to the host it show me the error below:Any suggestion? I have not seen this error beforePlease any helpRegards, Server Error in '/' Application. Content controls are allowed only in content page that references a master page. Description: Anunhandled exception occurred during the execution of the current webrequest. Please review the stack trace for more information about theerror and where it originated in the code. Ex...

error: Content controls are allowed only in content page that references a master page.
 I have a website that uses a masterpage. most of my users have no problem; but few get the error bellow. I was never able to duplicate the error.   ex.message: Content controls are allowed only in content page that references a master page.Stack trace:    at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)   at System.Web.UI.Page.get_Master()   at System.Web.UI.Page.ApplyMasterPage()   at System.Web.UI.Page.ProcessRequestMain(Boolean in...

Show content in both Master Page ContentPlaceholder AND Content Page Content control
I note that by default or rendering rules, when you add content/controls to the Content Page ASP:Content control matched to a Master Page ContentPlaceholder, any content/controls in the matching Master Page ContentPlaceholder is not displayed. Is there a setting that can be made to merge or show both content/controls in the Master Page ContentPlaceholder and content/controls in the matching Content Page Content control? Thanks         Don't think so. If you specify a content control in your page then whatever is in there displays and anything in the...

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Need to access a Label Control on the Master Page from a user control attached to a content page
Hello all, I have a master page (say  site.master)  with a status Label in it. I have a content page ( say content.aspx)  that has a user control (say usercontrol.ascx). One of the Button Click Events in the usercontrol.ascx needs to pass on some text onto the status label on the masterpage(LabelStatusMsg) and display it. I have been able to do this directly off a content page (content.aspx) by using the following code (VB)  on the master page <%@ MasterType virtualpath="~/site.master" %> and Dim mpLabel As Label = CType(Master.FindControl("LabelStatusMsg"),...

convertion from page to content page or from user control to content page
Hi, I have converted an asp.net 1.1 application to 2.0.  Now what I am looking for some enhancement.  I added a master page and now I want to add other pages as content pages. but those pages which I am converting into content have some user control. Now either I can convert those user control to content pages ( which i want to look for if it is possible),  Or I am thinking i shouldn't convert those user control to content pages cause they might be just good. So looking for some of those people opinion who have worked through this so can I get opinion here please.thanks&nb...

Accessing a master page's control in a nested content Page(Urgent)
Hi all, I have a masterpage rm_master.masterand another masterpage rm_sub.master which inherits from rm_master.master. Now I want to access a dropdownlist control in a content page which derieves from rm_select_master. the code i used wasDropDownList DropDownList1 = (DropDownList)Master.FindControl("DropDownList1");string a; a = DropDownList1.Text;   The error i got was "Object reference not set to an instance of an object". Please help.. Thanks in advance.. Bharath You can try Page.FindControl or use the mastertype directivePlease remember to click “...

Accessing master page controls from content page
Hello,Here's a snippet from my listing.master page:<%@ master Language="C#" %>     public string Listing_Name    {        get { return lis_name.Text; }    }    protected void Page_Load(object sender, EventArgs e)    {       lis_name.Text = "Hello World"    } ---------------------------------------------------------------------------------------------------------------In my content page, Master.Listing_Name shows blank, why?<...

content page changing master page controls
So I have a master page.  It consists of a banner and a set of ImageButtons that run down the left side of the screen that serve as the navigation bar of my site.  At the first page, most buttons have their visibility set to false.The user logs in using forms authentication, and it is my desire to set the visibility to true on buttons based on login information. So, I set the ImageButtons up with public properties. For example:  public ImageButton MPHomeButton { get { return HomeButton; } set { HomeButton = value; } } Then, when I authenticate the user I  ...

Trigger a control in Master from control in content page?
Hi!So how can I trigger the button click (or change hidden field?) in Master page from the button click event in content page? I need that because I have a popupcontrol in master page. I set it like this to have a "Add to cart" functionality - the button is in content page and the cart (popup) is in master. Like in gap.com... Been trying to figure that one out for days..  hiif you want to access a control which is in the master page from a client page..then you write a code like thisImageButton imgButton = (ImageButton)Master.FindControl("imageStep4");imgButto...

Change master page controls from content page
Hi,  I have a master page with tabs menu ("primarynav"), and I want the 'selected' tab, meaning the one that suits the specific content page, to appear as selected. The way I did it is adding this code to the content page: <script type="text/javascript">document.body.onload = function() { document.getElementById('HelpTab').outerHTML = "<LI class=\"selected\" id=HelpTab onclick=SetHelpTab(); _extended=\"true\"><A href=\"Help.aspx\" _extended=\"true\">Help</A> " } </sc...

Web resources about - Content controls have to be top-level controls in a content page or a nested master page that references a master page. - asp.net.navigation-controls

European Terrestrial Reference System 1989 - Wikipedia, the free encyclopedia
The European Terrestrial Reference System 1989 ( ETRS89 ) is a ECEF (Earth-Centered, Earth-Fixed) geodetic Cartesian reference frame , in which ...

Microsoft dismisses iPad Pro as “a companion device” and references old Steve Jobs stylus quote
... to be a companion device.” Laycock also said that “at one point in time, Apple declared that if there’s a stylus, that’s failure” – a reference ...

Shane Smith Also Dropped a David Carr Reference
On The Drudge Report and elsewhere, much is being made today about the fact that Shane Smith drops 52 F-bombs in this week’s Hollywood Reporter ...

All of The Simpsons’ best movie references compiled in one video
After 27 seasons on the air, it only makes sense that The Simpsons would reference every show, movie, book and pop culture artifact that it possibly ...

There's a wonderful hidden 'Indiana Jones' reference in 'Star Wars: The Force Awakens'
Sound editors for "Star Wars: The Force Awakens" managed to slide an "Indiana Jones" Easter egg into the film. In an interview with Nerdist ...

Worst passwords of 2015: Star Wars references sneak onto list
Enough with "123456" already! SplashData's annual list of the worst passwords in use includes some old favorites and some new sci-fi-inspired ...

The Flash: Easter Eggs and DC Comics References In "Welcome to Earth-2"
Tonight was the most Easter egg-heavy episode of The Flash to date.Let's get right into it [...]

Ricky Gervais Defends His Golden Globes Joke About Caitlyn Jenner With a Bill Cosby Reference
Ricky Gervais Defends His Golden Globes Joke About Caitlyn Jenner With a Bill Cosby Reference

9 Ways Your References Can Help You Land Your Next Job
Are your references selling your best attributes—or selling you out? Here's how to make them more effective for you. You're going for a new ...

Everything You Always Wanted To Know About Job References
Not sure how the whole job-reference thing works? Here's a quick guide to help you!

Resources last updated: 2/13/2016 10:02:31 AM