I have a Dot Net 4.0 web app with quite a few of those <% %> tags scattered throughout the scripts of various pages. Most pages have at least a little JavaScript, mostly routine stuff like custom validator handlers for dropdowns.
Today I got an exception: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
This was fixed by placing the script block on that page in a RadCodeBlock.
I've been looking at this documentation: http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html.
It occurs to me that this RadCodeBlock is only the second one I've added to the entire project. I've not had problems with other pages.
In general would you say that it's good coding practice to routinely enclose all JavaScript blocks in RadCodeBlocks?
Today I got an exception: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
This was fixed by placing the script block on that page in a RadCodeBlock.
I've been looking at this documentation: http://www.telerik.com/help/aspnet-ajax/ajax-radscriptblock-radcodeblock.html.
It occurs to me that this RadCodeBlock is only the second one I've added to the entire project. I've not had problems with other pages.
In general would you say that it's good coding practice to routinely enclose all JavaScript blocks in RadCodeBlocks?