Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am trying to add master page reference in the aspx page but i get the error:

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

"

How can I add this?

Thanks,
Rami
Posted

1 solution

All your content in the Content Page should be wrapped inside
ASP.NET
<asp:content .. 

tag that corresponds to the
ASP.NET
<asp:ContentPlaceHolder ..

of your masterpage.
The simple and quick solution is to create a new page and while make adding the page from Template, make sure that you have checked the Checkbox for referencing MasterPage if you are using Visual Studio to develop your application and in the next screen select the masterpage. Then just copy the content of your existing page which is wrapped inside form tag (normally).

Check this link-
http://www.brainbrushups.com/2013/05/create-master-page-and-content-page-in.html[^]

Hope, it helps :)

If your problem still exists, please share the relevant code so that we can identify actual issue.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900