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


Today one of my team mate faced a strange problem while copying pages from one project to another.

What happen it shows the error like

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

The Same pages are working fine in previous place & run perfectly but after moving the pages we are facing the error shown above.

Now When i saw the error initially i thought there was problem in Ajax Control because it was redirecting me to the AjaxToolkit Base Class library javascript file.

But i was not able to figure out the problem so i typed this error in Google & got some of the solutions but the following solution by LeeDumond helped me to solve the issue i was facing.

So i decided to share it with you.

Problem

If you’re using Master Pages in ASP.NET and trying to resolve <script> or <style> references in the page head, you may have run into this this show-stopper. If so, here’s why it’s happening, and here’s an easy way to fix it.

If you’ve worked with ASP.NET Master Pages, you’ve no doubt taken advantage of automatic URL re-basing within the HtmlHead control.

Read more

 

Hope this will help

Jay Ganesh

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s