This is a migrated thread and some comments may be shown as answers.

"Code blocks are not allowed in this file"

5 Answers 212 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 09 Apr 2009, 06:54 PM
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?

5 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 13 Apr 2009, 10:05 AM
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.
0
Robert
Top achievements
Rank 1
answered on 13 Apr 2009, 04:37 PM
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?




0
Accepted
Iana Tsolova
Telerik team
answered on 14 Apr 2009, 10:12 AM
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.
0
Bhavya
Top achievements
Rank 1
answered on 22 Dec 2015, 06:07 AM

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. :)

 

0
Pavlina
Telerik team
answered on 22 Dec 2015, 08:19 AM
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
Tags
Sharepoint Integration
Asked by
Robert
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Robert
Top achievements
Rank 1
Bhavya
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or