<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Client Side Web Development</title><link>http://forums.asp.net/130.aspx</link><description>Client-side programming discussions, including CSS, DHTML, JScript/Javascript, etc. &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=18&amp;c=16" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2757841.aspx</link><pubDate>Thu, 20 Nov 2008 13:36:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2757841</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2757841.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2757841</wfw:commentRss><description>&lt;p&gt;I think that it is when the parser happens to try to resolve the &amp;lt;%= %&amp;gt; tags. If controls are being created at that time, you get that error.&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2756287.aspx</link><pubDate>Wed, 19 Nov 2008 21:36:43 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2756287</guid><dc:creator>vadambaibala</dc:creator><author>vadambaibala</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2756287.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2756287</wfw:commentRss><description>&lt;p&gt;i faced the same issue but i did the same thing it worked i think this post made me clear why ... thanks&lt;/p&gt;</description></item><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2756257.aspx</link><pubDate>Wed, 19 Nov 2008 21:22:53 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2756257</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2756257.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2756257</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes it did.&amp;nbsp; I had already done that as a work-around anyways.&amp;nbsp; THe odd thing is, some of my pages the error shows up on, others it doesn&amp;#39;t... in both situations there is javascript methods in the &amp;lt;head&amp;gt; that use &amp;lt;%= myElement.CliendID %&amp;gt; to refer to the object for access it&amp;#39;s value.&amp;nbsp; I&amp;#39;m in the middle of another project atm, once I get a chance I&amp;#39;ll read up on those links you mentioned to see if I can expand my knowledge in this area.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Rob &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2755894.aspx</link><pubDate>Wed, 19 Nov 2008 18:17:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2755894</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2755894.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2755894</wfw:commentRss><description>&lt;p&gt;So&amp;nbsp;did moving the JavaScript out of the &amp;lt;head&amp;gt; tags work?&lt;/p&gt;
&lt;p&gt;NC...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2755868.aspx</link><pubDate>Wed, 19 Nov 2008 18:04:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2755868</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2755868.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2755868</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks NC.&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2755852.aspx</link><pubDate>Wed, 19 Nov 2008 17:55:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2755852</guid><dc:creator>NC01</dc:creator><author>NC01</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2755852.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2755852</wfw:commentRss><description>&lt;p&gt;Try moving the JavaScript out of the &amp;lt;head&amp;gt; tags to below the &amp;lt;/form&amp;gt; tag so that the elements can be created first.&lt;/p&gt;
&lt;p&gt;Here are some explanations and other work-arounds if that doesn&amp;#39;t help:&lt;br /&gt;&lt;a href="http://west-wind.com/WebLog/posts/6148.aspx"&gt;http://west-wind.com/WebLog/posts/6148.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.west-wind.com/weblog/posts/5758.aspx"&gt;http://www.west-wind.com/weblog/posts/5758.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are many more that I found with a Google search:&lt;br /&gt;&lt;a href="http://www.google.com/search?hl=en&amp;amp;q=The+Controls+collection+cannot+be+modified+because+the+control+contains+code+blocks&amp;amp;btnG=Search"&gt;http://www.google.com/search?hl=en&amp;amp;q=The+Controls+collection+cannot+be+modified+because+the+control+contains+code+blocks&amp;amp;btnG=Search&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;NC...&lt;br /&gt;&lt;/p&gt;</description></item><item><title>The Controls collection cannot be modified because the control contains code blocks (i.e. &lt;% ... %&gt;).</title><link>http://forums.asp.net/thread/2755600.aspx</link><pubDate>Wed, 19 Nov 2008 16:11:42 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2755600</guid><dc:creator>RobSil</dc:creator><author>RobSil</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2755600.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=130&amp;PostID=2755600</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I keep getting the error message ....&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;i&gt;The Controls collection cannot be modified because the control contains code 
blocks (i.e. &amp;lt;% ... %&amp;gt;).&lt;/i&gt;&amp;nbsp; &lt;/b&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I am trying to access the innerhtml of a div on my page in some javascript in my head tag.&amp;nbsp; Problem is, the &amp;lt;head&amp;gt; is runat=&amp;quot;server&amp;quot; because I also want to set page title dynamically.&amp;nbsp; My javascript in my head tag is...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script type=&amp;quot;text/javascript&amp;quot; language=&amp;quot;javascript&amp;quot;&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var defaultSBText = &amp;quot;Search for more info...&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function alertDivHTML() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var elementID = &amp;quot;&amp;lt;%= mainBodyContentPlaceholderDiv.ClientID %&amp;gt;&amp;quot;; &lt;/p&gt;&lt;p&gt;//error is thrown.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Can someone elaborate on this error and how to avoid it?&amp;nbsp; It seems like such a common task to do, accessing the CLientID of an elment in order to access it via javascript that i am assuming I am doing somethign blatantly wrong.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Rob &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>