"Code blocks are not allowed in this file"

6 posts, 2 answers
  1. Robert
    Robert avatar
    19 posts
    Member since:
    Feb 2009

    Posted 09 Apr 2009 Link to this post

    I have my wrapped in

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    But I still get the error:
    "Code blocks are not allowed in this file"

    Any ideas on what I could be missing here?
  2. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 13 Apr 2009 Link to this post

    Hello Robert,

    Could you please provide more information about the page with the problematic code blocks? In what context is the page called? 

    Please check out the below articles for more information of this error and see if the suggestions there are helpful:

    http://blogs.msdn.com/kaevans/archive/2007/04/26/code-blocks-are-not-allowed-in-this-file-using-server-side-code-with-sharepoint.aspx
    http://svengillis.blogspot.com/2008/03/code-block-are-not-allowed-in-this-file.html

    Let me know how it goes.

    Regards,
    Iana
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.

  3. Robert
    Robert avatar
    19 posts
    Member since:
    Feb 2009

    Posted 13 Apr 2009 Link to this post

    Thanks for the reply. Let me make sure I understand. I thought that adding

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    would stop the "code block" error.

    So even though I have a radcodeblock control I still need to set the page parserpath property?




  4. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 14 Apr 2009 Link to this post

    Hello Robert,

    Indeed, you still need to set page parserpath property.

    As you already found, RadCodeBlock should be used when you have server code blocks placed within the markup. And it is to prevent you from the server error: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
    You should use RadCodeBlock especially when you have RadAjax on your page. 
    Unfortunately it could not prevent you from the error you faced. 

    All the best,
    Iana
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Manu
    Manu avatar
    24 posts
    Member since:
    Aug 2015

    Posted 22 Dec 2015 in reply to Iana Tsolova Link to this post

    Hi,

    Greetings!

    Please help me out from my problem, it may be small but i cant make it out.

    I am using a RadTreeView. its working fine but my requirment is i want to add some condition in between nodes of treeview. so that i have to display nodes based on that if condition.

     Thanks in advance. :)

     

  6. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 22 Dec 2015 Link to this post

    Hi,

    As the question is about RadTreeView control I recommend you open a new ticket, choose the correct product and your question will be addressed accordingly.

    Regards,
    Pavlina
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top