controls collection cannot be modified

4 posts, 0 answers
  1. Paul
    Paul avatar
    8 posts
    Member since:
    Jul 2012

    Posted 03 Sep 2009 Link to this post

    Hi,

    I have upgraded RADControls - RADTreeView from ASP.NET to ASP.NET AJAX v2009.1.527.35.

    I get the error "controls collection cannot be modified" when the page loads.
    The RADControl declaration and associated code is given below.

    1 <telerik:RadTreeView id="AllControlsTree" Runat="server" Width="99%" OnContextMenuItemClick="Tree_ContextMenuItemClick" 
    2 OnClientContextMenuItemClicking="BeforeClientContextHandler" Height="60%"></telerik:RadTreeView> 
    3 <TABLE cellSpacing="2" cellPadding="0" width="260"
    4 <TR> 
    5   <TD onclick="AddControlsPostBack(<%= AllControlsTree.ClientID %>);" >Cell xxx 
    6     Add Controls To Version 
    7   </TD> 
    8 </TR> 
    9 </TABLE> 
    10  

    Already tried
    1 <telerik:RadTreeView id="AllControlsTree" Runat="server" Width="99%" OnContextMenuItemClick="Tree_ContextMenuItemClick" 
    2 OnClientContextMenuItemClicking="BeforeClientContextHandler" Height="60%"></telerik:RadTreeView> 
    3 <TABLE cellSpacing="2" cellPadding="0" width="260"
    4 <TR> 
    5   <TD onclick="AddControlsPostBack($find('<%= AllControlsTree.ClientID %>')" >Cell xxx 
    6     Add Controls To Version 
    7   </TD> 
    8 </TR> 
    9 </TABLE> 
    10  
    which gives the same error..

    Regards...
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 03 Sep 2009 Link to this post

    Hi Andy Hooper,

    Could you please paste the whole page? I couldn't reproduce the error using your markup in a new page.

    This error occurs when you are using <%= %> inside <script > tags. If this is the case wrap the <script> tag with the <telerik:RadScriptBlock> control. Here is an example:

    <telerik:RadScriptBlock runat="server" id="RadScriptBlock1">
              <script type="text/javascript">
                          //some JavaScript code here.
              </script>
    </telerik:RadScriptBlock>

    Regards,
    Albert
    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.
  3. Paul
    Paul avatar
    8 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2009 Link to this post

    Hi Albert,

    here is a page code for the issue.
    1 <%@ Page Language="vb" AutoEventWireup="false" Theme="NewWindow" %> 
    2 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    3  
    4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
    5 <HTML style="MARGIN: 0px; WIDTH: 100%; HEIGHT: 100%"
    6     <HEAD runat="server"
    7         <title>MasterPlan Amendments Module</title> 
    8         <LINK href="../../MasterView.css" type="text/css" rel="stylesheet"
    9         <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"
    10         <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"
    11         <meta content="JavaScript" name="vs_defaultClientScript"
    12         <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"
    13     </HEAD> 
    14  
    15     <body style="MARGIN: 0px; WIDTH: 100%"
    16         <form id="frmAmendments" style="MARGIN: 0px; WIDTH: 100%; HEIGHT: 100%" method="post" runat="server"
    17             <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    18 <script language="javascript"
    19  
    20     function refreshGrid() 
    21     { 
    22     //alert('hello'); 
    23     window["<%=EventsGrid.ClientID %>"].AjaxRequest('<%= EventsGrid.UniqueID %>', 'Rebind');   
    24      
    25     } 
    26     function clearDates() 
    27     { 
    28         var dateInput1 = '<%= RadDatePicker1.ClientID %>'
    29         var dateInput2 = '<%= RadDatePicker2.ClientID %>'
    30         dateInput1.DateInput.Clear(); 
    31         dateInput2.DateInput.Clear(); 
    32     } 
    33     function SelectUnselect(treeView,action) 
    34     {    
    35         for (var i=0; i<treeView.AllNodes.length; i++) 
    36         { 
    37             if (action == "check") 
    38             { 
    39                 treeView.AllNodes[i].Check(); 
    40             } 
    41             else 
    42             { 
    43                 treeView.AllNodes[i].UnCheck(); 
    44             } 
    45         }               
    46     }    
    47  
    48  
    49  
    50 </script>            
    51  
    52             <div style="height:80px;"
    53             <span style="position:absolute;top:3px;left:3px; align:left;"><asp:Label id="lblHeading" Runat="server"></asp:Label></span
    54             </div> 
    55             <telerik:RadSplitter id="Radsplitter1" runat="server" width="100%" height="800" skin="Default"
    56                 <telerik:RadPane id="LeftPane" runat="server" height="100%" width="22" skin="Default"
    57                     <DIV style="Z-INDEX: 100; POSITION: relative"><!-- Put sliding menu on top of tabs --> 
    58                         <telerik:RadSlidingZone id="ControlsSlidingZone" runat="server" width="22" InitiallyDockedPaneId="AllControlsSlidingPane" 
    59                             clicktoopen="true" skin="Default"
    60                             <telerik:RadSlidingPane id="AllControlsSlidingPane" title="All Controls" runat="server" width="310" scrolling="Y" 
    61                                 IconUrl="../../common/baseimages/refresh.gif" skin="Default"
    62                                 <telerik:RadAjaxLoadingPanel id="ajxlp2" height="75px" width="75px" Runat="server" skin="Default"
    63                                     <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0px;" /> 
    64                                 </telerik:RadAjaxLoadingPanel>   
    65                                 <telerik:RadAjaxPanel id="Radajaxpanel2" runat="server" LoadingPanelID="ajxlp2" skin="Default">Select Instrument:<BR> 
    66 <asp:DropDownList id="ddInstruments" Runat="server" Width="260" CssClass="inpt" OnSelectedIndexChanged="ddInstruments_SelectedIndexChanged" 
    67                                         AutoPostBack="True"></asp:DropDownList><BR><BR> 
    68 <TABLE cellSpacing="2" cellPadding="0" width="260"
    69                                         <TR> 
    70                                             <TD vAlign="middle" bgColor="silver" colSpan="2" height="1"></TD> 
    71                                         </TR> 
    72                                         <TR> 
    73                                             <TD class=buttonRow onmouseover="this.className='buttonRowOver'"  
    74     onclick="SelectUnselect(<%= AllControlsTree.ClientID %>,'check');"  
    75     onmouseout="this.className='buttonRow'" vAlign=top>&nbsp;<IMG src="../../common/baseimages/next.png" border="0"> Select All  
    76                                                 Controls 
    77                                             </TD> 
    78                                         </TR> 
    79                                         <TR> 
    80                                             <TD vAlign="top" bgColor="silver" colSpan="2" height="1"></TD> 
    81                                         </TR> 
    82                                         <TR> 
    83                                             <TD class=buttonRow onmouseover="this.className='buttonRowOver'"  
    84         onclick="SelectUnselect(<%= AllControlsTree.ClientID %>,'uncheck');"   
    85     onmouseout="this.className='buttonRow'" vAlign=top>&nbsp;<IMG alt="Select None" src="../../common/baseimages/previous.png" border="0"
    86                                                 Unselect All Controls 
    87                                             </TD> 
    88                                         </TR> 
    89                                         <TR> 
    90                                             <TD vAlign="top" bgColor="silver" colSpan="2" height="1"></TD> 
    91                                         </TR> 
    92                                         <TR> 
    93                                             <TD class=buttonRow onmouseover="this.className='buttonRowOver'"  
    94         onclick="AddControlsPostBack(<%= AllControlsTree.ClientID %>);"  
    95     onmouseout="this.className='buttonRow'">&nbsp;<IMG alt="Add Controls" src="../../common/baseimages/ico_dlg.gif" border="0">  
    96                                                 Add Controls To Version 
    97                                             </TD> 
    98                                         </TR> 
    99                                         <TR> 
    100                                             <TD vAlign="top" bgColor="silver" colSpan="2" height="1"></TD> 
    101                                         </TR> 
    102                                         <TR> 
    103                                             <TD class="buttonRow" onmouseover="this.className='buttonRowOver'" onmouseout="this.className='buttonRow'"
    104                                                 <asp:CheckBox id="chkPending" Runat="server" AutoPostBack="True" Text="Show Pending"></asp:CheckBox>&nbsp;&nbsp;&nbsp; 
    105                                                 <asp:CheckBox id="chHistoric" Runat="server" AutoPostBack="True" Text="Show Historic"></asp:CheckBox> 
    106                                             </TD> 
    107                                         </TR> 
    108                                         <TR> 
    109                                             <TD vAlign="top" bgColor="silver" colSpan="2" height="1"></TD> 
    110                                         </TR> 
    111                                     </TABLE> 
    112                                         <telerik:RadTreeView id="AllControlsTree" Runat="server" Width="99%" OnContextMenuItemClick="Tree_ContextMenuItemClick" 
    113                                      OnClientContextMenuItemClicking="BeforeClientContextHandler" Height="60%"></telerik:RadTreeView></telerik:RadAjaxPanel> 
    114                             </telerik:RadSlidingPane> 
    115                             </telerik:RadSlidingZone></DIV
    116                 </telerik:RadPane> 
    117                 <telerik:RadSplitBar id="RadSplitBar1" runat="server" skin="Default"></telerik:RadSplitBar> 
    118                 <telerik:RadPane id="ContentPane" runat="server" height="800" scrolling="Y" skin="Default"
    119                 </telerik:RadPane> 
    120             </telerik:RadSplitter><telerik:RadWindowManager  id="Singleton" runat="server" VisibleOnPageLoad="false" behavior="Close,Move" Skin="Default"></telerik:RadWindowManager> 
    121         </form> 
    122     </body> 
    123 </HTML> 

    Thanks...
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 08 Sep 2009 Link to this post

    Hello Andy Hooper,

    Unfortunately I cannot run your page. Could you try wrapping the script tags with a RadScriptBlock control as suggested earlier? Does this solve the problem? If not please open a support ticket and send us the codebehind of the page as well so we can test it locally.

    Regards,
    Albert,
    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.
Back to Top