How do I troubleshoot : "Only Content controls are allowed directly in a content page that contains Content controls." RRS feed

  • Question

  • User1857760563 posted

    Most of the searches related to this error specify sharepoint or registerscript, of which I'm not using either? This error started all of the sudden after writing/copying a fair amount of code, so I'm not sure what specifically triggered it and it is definitely my mistake with poorly written code, from being new to asp so don't take anything for granted.

    How do you troubleshoot this error?

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

    Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.

    Source Error: 

    Line 195:
    Line 196:
    Line 197:  <script type="text/javascript">
    Line 198:        
    Line 199:        // region document ready

    Source File: /Default.aspx    Line: 197 

    Thursday, May 24, 2018 3:58 PM

All replies

  • User1857760563 posted

    For anyone that stumbles upon this in a search

    As a last resort, I created a new project and copied the code over and it still occurred, then I created an empty project and it still occurred, so I closed all instances of Visual Studio and (presumably) cleared out any cache or memory objects and then the same code that was failing worked properly.

    I made many suggested changes I found on the internet when troubleshooting this, so the fix may have been a combination of those and closing Visual Studio.

    Thursday, May 24, 2018 6:21 PM
  • User283571144 posted

    Hi turbosupramk3,

    According to the error message, there are too many reasons why show this error.

    For example, there are two content controls that had the same ID.

    Could you please post the whole page's codes?

    Does this page has the master page?

    If you could post more details information and codes, it will be more easily for us to reproduce the issue and solution.

    Best Regards,


    Friday, May 25, 2018 2:11 AM