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

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

6 Answers 415 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Irfan Ahmed
Top achievements
Rank 2
Irfan Ahmed asked on 20 Mar 2012, 12:23 PM
Hi,
 I have downloaded latest trial version of RadControls for ASP.NET.

I am just trying to use the RadEditor in my asp.net mvc view.
I tried http://www.telerik.com/help/aspnet-ajax/editor-getting-started.html
and
http://www.telerik.com/help/aspnet-ajax/mvc-using-editor.html

I just placed the editor on my view, no coding, nothing, but still i am getting the following error message in execution -
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

I have looked various forums on telerik but doesn't found appropriate one to get the answer.
So finally requesting the support.

I have also created support ticket (523566) for this issue.

Please find the attached code i have tried.
Please help me resolve this issue.

Thanks and regards
Irfan Sheikh

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 21 Mar 2012, 04:52 PM
Hello,

I examined the provided project and found that this generic ASP.NET error is due to you have placed server tags inside the runat=server head tag of the master page. I fixed it by wrapping the script tag inside RadCodeBlock, e.g.
Copy Code
<telerik:RadCodeBlock id="RadCodeBlock1" runat="server">
  <script src="<%: Url.Content("~/Scripts/jquery-1.4.4.min.js") %>" type="text/javascript"></script>
  </telerik:RadCodeBlock>

Greetings,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Irfan Ahmed
Top achievements
Rank 2
answered on 22 Mar 2012, 06:47 AM
Thanks Rumen
For your kind support even in trial period.
0
hemant
Top achievements
Rank 1
answered on 05 Mar 2014, 11:59 AM
i have installed a trial version of telerik for asp.net web application development  but if i used any of telerik control like rad data grid then i an having an error like "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." please reply as soon as possible...
0
hemant
Top achievements
Rank 1
answered on 05 Mar 2014, 12:01 PM
I have seen earlier your post regarding to this error but i did not understand where I have to Change in my code..
0
Ianko
Telerik team
answered on 06 Mar 2014, 07:39 AM
Hi Hemant,

The problem described by Irfan and resolved by Rumen is an isolated case and it is related also to MVC.

Please open a new thread with more information about:
  • Is the built project an MVC one?
  • Do you have issues with ordinary ASP.NET control?
  • Ca you verify that the markup of the controls does not contain properties or attributes in comment blocks?

A new support thread with detail about the project or attached one that demonstrates the problem will be very helpful for us to isolate and investigate the problem.


Regards,
Ianko
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

0
Suresh
Top achievements
Rank 1
answered on 13 Jun 2016, 04:36 PM

Its great help!!!

wrapping javascript inside <telerik:RadScriptBlock ID="radSript1" runat="server"> worked for me.

 

Thanks

Suresh T G

Tags
Editor
Asked by
Irfan Ahmed
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Irfan Ahmed
Top achievements
Rank 2
hemant
Top achievements
Rank 1
Ianko
Telerik team
Suresh
Top achievements
Rank 1
Share this question
or