.

Content controls are allowed only in content page that references a master page

Solutions to the following error:

Content controls are allowed only in content page that references a master page

You get this error when you have no masterpage assigned to your web form

Options to consider (other than simply adding your masterpage statically):

You can derive all your pages from a base page in the web config file:

    <system.web>
      <pages pageBaseType="BasePage" >

then create a class and declare it as follow:

 

   public class BasePage : System.Web.UI.Page
   { ....

with the following method in it:

 

protected override void OnPreInit(EventArgs e)
    {
        string ThemeName = "Bitlink";
        //this should point to your masterpage:
        MasterPageFile = VirtualPathUtility.ToAbsolute(("~/")) +
           "Themes/" + ThemeName + "/Master.master";
        base.OnPreInit(e);
    }

 

this way all your pages would be assigned to a certain masterpage dynamically.

What's your thoughts on this?

*

Protected by WP Anti Spam