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.
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.
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.
Hope this will help