Master Page Weirdness - “Content controls have to be top-level controls in a content page or a nested master page that references a master page.”

后端 未结 13 1908
借酒劲吻你
借酒劲吻你 2020-12-05 06:28

This is weird. I added a brand new Web Application project to my solution in Visual Studio 2008.

Created a master page. Made zero modifications. Created a new we

相关标签:
13条回答
  • 2020-12-05 06:58

    I just encountered this exception and in my case it was cause by a white space between asp:content elements

    So, this failed:

    <asp:content runat="server" ContentPlaceHolderID="Header">
        Header
    </asp:content>
    
    <asp:Content runat="server" ContentPlaceHolderID="Content">
        Content
    </asp:Content>
    

    But removing the white spaces between the elements worked:

    <asp:content runat="server" ContentPlaceHolderID="Header">
        Header
    </asp:content><asp:Content runat="server" ContentPlaceHolderID="Content">
        Content
    </asp:Content>
    
    0 讨论(0)
提交回复
热议问题