Hey Guys,
I've made a couple of web pages and now i want to add a master page to all the pages. But when i tried to add the master page the following error occured
"Content controls have to be top-level controls in a content page or a nested master page that references a master page."

FYI i did not check the check box "Select Master Page" when i was making the pages. Does this make a difference??
Please suggest how i could add master pages to my web pages??

7 Years
Discussion Span
Last Post by ShivaSaurabh

If you want to add Master Page to your existing web pages, the do the following things:

1. set the MasterPageFile property to your .master file name.
2. Remove the form tage from the child page if the master page already has the form tag.
3. Wrap controls in the child page with a Content control

<asp:Content id="myContent" runat="server" ContentPlaceholderId="MasterID">  page contents</asp:Content>

The value of ContentPlaceHolderID should be the ID of the ContentPlaceHolder control from the master page.

Also check this link: http://asptutorials.net/ASP/masterpages/


try giving out the content page same as that given to the master page id. also see the content page has the master page file directive

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.