Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content controls have to be top-level controls

Tags:

asp.net

I have a website that can be accessed from www.blahblah.com and special.blahblah.com. The www site always works but occasionly I get a 'Content controls have to be top-level controls in a content page or a nested master page that references a master page' error on the special site.

It's exactly the same code running in both situations and the offending page doesn't even have a master page. Why would it work all the time on one and fail sometimes on the other?

like image 922
horatio Avatar asked Nov 24 '08 04:11

horatio


2 Answers

If anyone gets this error message when dynamically switching master pages, make sure your code is

MasterPageFile = "TheMasterPage.master"

Not

this.master.MasterPageFile = "TheMasterPage.master"
like image 87
MGOwen Avatar answered Oct 26 '22 09:10

MGOwen


Just got this problem. It was because we had a tag ending with double slashes:

<//asp:HyperLink>
like image 24
Daniel Ryan Avatar answered Oct 26 '22 09:10

Daniel Ryan