This is a migrated thread and some comments may be shown as answers.

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

2 Answers 633 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bharat
Top achievements
Rank 1
Bharat asked on 08 Feb 2014, 12:30 PM
I am showing user control based on some conditions using code block while using telerik radgrid in my page
but I am getting the below message

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


Here is code in my aspx page.

<% if (parentcompany_id != 2840 && parentcompany_id == 2960)
             { %>
       <div class="Drop-down-div" style="clear:both" >
            <div style="margin-top: 5px; clear:both; width: 74px" class="Drop-down-child">Other Filter </div>
            <div class="Drop-down-child">
            <uc1:EventFilter ID="EventFilter1" runat="server" />
            </div>
            <div class="Drop-down-child">
            <uc1:Status ID="Status1" runat="server" />
            </div>
        </div>
            <%} %>

If I remove this code it works fine, Please let me know what i am missing


Thanks & Regards
Bharat Bhushan

2 Answers, 1 is accepted

Sort by
0
Accepted
A2H
Top achievements
Rank 1
answered on 09 Feb 2014, 05:01 AM
Hi,
Try to Wrap your code inside a TelerikRadCodeBlock control like given below
<telerik:radcodeblock id="RadCodeBlock1" runat="server">
            <% if (parentcompany_id != 2840 && parentcompany_id == 2960)
               { %>
         <div class="Drop-down-div" style="clear:both" >
            <div style="margin-top: 5px; clear:both; width: 74px" class="Drop-down-child">Other Filter </div>
            <div class="Drop-down-child">
            <uc1:EventFilter ID="EventFilter1" runat="server" />
            </div>
            <div class="Drop-down-child">
            <uc1:Status ID="Status1" runat="server" />
            </div>
         </div>
            <%} %>
        </telerik:radcodeblock>
Refer the paragraph no 6 of this help article
0
Bharat
Top achievements
Rank 1
answered on 10 Feb 2014, 08:23 AM
Thanks, it is working fine.
Tags
Grid
Asked by
Bharat
Top achievements
Rank 1
Answers by
A2H
Top achievements
Rank 1
Bharat
Top achievements
Rank 1
Share this question
or