Appear in Online Interview to test your skills and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Submit content and win cash & prizes monthly.

Win Prizes

Like us on Facebook
Top Forums Author
Thu, 24-Apr-2014 Authors
All Time Authors

Latest members | More ...

(Statistics delayed by 5 minutes)

System.Web.HttpException: Content controls have to be top-level controls in a content page or a nest

Posted by SheoNarayan under Error and Resolution on 2/18/2011 10:16:21 AM | Points: 10 | Views : 7611 | Status : [Microsoft_MVP] [Administrator] | Replies : 0
I was getting this error when trying with the Nested Master page.

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

You need to focus following while dealing with this issue

1. By default Visual Studio doesn't not create ContentPlaceHolder control in the Child Master page, for example look at the below code

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<p>Written in child master page </p>
<asp:ContentPlaceHolder id="ChildMasterContentPlaceHolder1" runat="server">


You will need to make sure that you are keeping the ContentPlaceHolder control inside the asp:Content control.

2. Any content (plain text/html control/ control) either in the Child master page or Content page must be inside the asp:Content control.

3. You can keep any content in the Maste Master page under body tag.

4. The hierarchy of Page_Load method fires like this
--------------Content page page_load
-------------------Child master page page_load
-------------------------Master master page_load

Hope this helps.


Sheo Narayan
The Founder

Reply | Reply with Attachment

=> Scroll below for responses

Comments or Responses

Login to post response.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: