I've posted this to the forum as well, feel free to respond to either this or the forum
I'm getting The Controls collection cannot be modified because the control contains code blocks (i.e. <%
Our code contains the following
<% if displaythis = False %>
.
.
<%else%>
.
.
<%end if%>
I've tried <%# If displaythis = False Then %> but that doesn't work, it doesn't even
compile. I've googled this to death and I'm at a complete loss at this point.
Any help is greatly appreciated.
I can't use the
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<%If UseIcons = False Then %>
</telerik:RadCodeBlock>
bunch of code
.
.
.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<%End If %>
</telerik:RadCodeBlock>
6 Answers, 1 is accepted
When you use server-side code blocks, you need to wrap the entire logic inside a single RadCodeBlock instance to avoid the error you get. More information on this subject can be found in this topic from the RadAjax documentation.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I'm getting The Controls collection cannot be modified because the control contains code blocks (i.e. <%
Our code contains the following
<table width=80%>
<tr>
<td CssClass="normal_text" align="left"> </td>
<td align="left">CONTENT 2</td>
</tr>.
<% if (Flag == False) {%>
<tr>
<td CssClass="normal_text" align="left"> </td>
<td align="left">CONTENT 1</td>
</tr>
<%}else{%>
<tr>
<td CssClass="normal_text" align="left"> </td>
<td align="left">CONTENT 2</td>
</tr>.
.
<%}%>
<tr>
<td CssClass="normal_text" align="left"> </td>
<td align="left">CONTENT 2</td>
</tr>.
</table>
Thanks
Onkar
Try wrapping any server-code or client-code on your aspx page into a RadCodeBlock or RadScriptBlock control and see if it makes a difference as mentioned by Sebastian.
-Princy.
I tried to do as you wrote but nevertheless it seems that still I am having the problem to use code within my radAjaxManager.
Error:
========
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Thank,
Tal
I tried to do as you wrote but nevertheless it seems that still I am having the problem to use code within my radAjaxManager.
Error:
========
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Any ideas how to help ?
Thanks,
Tal
Can you please post a simple code-snippet that demonstrates the issue? We would like to investigate the behavior you depicted.
Regards,
Pavlina
Telerik