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. ).

1 Answer 142 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Chris Trina
Top achievements
Rank 1
Chris Trina asked on 16 Sep 2010, 11:09 PM
 I'm attempting to use radAjax with a radgrid that does drag and drop.  I've done this before successfully, but in this case I cannot get beyond the error message,

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

  I've read the support articles and have wrapped everything in either RadCodeBlocks or RadScript blocks, but the error is still there.  Any help would be appreciated, I've included the radgrid and the radajax code.

<
telerik:RadGrid runat="server" ID="grdUnits" AllowPaging="False" Width="100%" AllowMultiRowSelection="false">
    <MasterTableView DataKeyNames="UnitID" Width="100%" TableLayout="Fixed" AutoGenerateColumns="false">
  <Columns>
            <telerik:GridBoundColumn UniqueName="CourseID"  Visible="False" DataField="CourseID" ReadOnly="True"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn UniqueName="UnitID" Visible="False" DataField="UnitID"></telerik:GridBoundColumn>
            <telerik:GridDragDropColumn HeaderStyle-Width="18px" ItemStyle-Width="18px"></telerik:GridDragDropColumn>
            <telerik:GridTemplateColumn HeaderText="Units" HeaderStyle-Width="460px" HeaderStyle-Font-Bold="true">
          <ItemStyle Width="460px" VerticalAlign="Top"></ItemStyle>
          <ItemTemplate>
             <telerik:RadCodeBlock runat="server" ID="cb2">
                                <a href='UnitDetails.aspx?sAction=Edit&CourseID=<%# Container.DataItem("CourseID") %>&UnitID=<%# Container.DataItem("UnitID")%>'>
                                <%# Container.DataItem("UnitName")%>
                                </a>
                                </telerik:RadCodeBlock>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Duration" HeaderStyle-Font-Bold="true">
                                        <ItemStyle Width="90px" VerticalAlign="Top"></ItemStyle>
                                        <ItemTemplate>
                                            <asp:Label id="Label8" runat="server" text='<%# GetDuration(container.dataitem("UnitIsOngoing"),Container.DataItem("UnitDuration"),Container.dataItem("UnitOfDurationName"))%>'>
                                        </asp:Label>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Delete" HeaderStyle-Width="50px" HeaderStyle-Font-Bold="true">
                                        <ItemStyle Width="50px" HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
                                        <ItemTemplate>
                                        <telerik:RadCodeBlock runat="server" ID="cb3">
                                            <a onclick='DeleteConfirm(<%# Container.DataItem("UnitID")%>)' href="#here"><IMG id="imgDelete" alt="Delete" src="../Images/delete.gif" border="0"></a>
                                        </telerik:RadCodeBlock>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                            </MasterTableView>
                            <ClientSettings AllowRowsDragDrop="true" >
                                <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                            </ClientSettings
                        </telerik:RadGrid>


<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
               <AjaxSettings>
                   <telerik:AjaxSetting AjaxControlID="grdUnits">
                       <UpdatedControls>
                           <telerik:AjaxUpdatedControl ControlID="grdUnits" />
                       </UpdatedControls>
                   </telerik:AjaxSetting>
               </AjaxSettings>
           </telerik:RadAjaxManager>
           <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Windows7" Transparency="30"  
               IsSticky="true" style="position:absolute; top:0; left:0; height:100%; width:100%;">
           </telerik:RadAjaxLoadingPanel>

1 Answer, 1 is accepted

Sort by
0
Chris Trina
Top achievements
Rank 1
answered on 17 Sep 2010, 01:06 PM
I found the issue, the grid itself was fine.  The issue was actually some javascript block that seemed pretty simple but still needed to be wrapped with a RadScript Block.

Thanks anyways

Chris
Tags
Ajax
Asked by
Chris Trina
Top achievements
Rank 1
Answers by
Chris Trina
Top achievements
Rank 1
Share this question
or