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

  • Question

  • User-1255549113 posted

    Hey guys


    I came across this bug using while trying to implement a sitemap




    Line 147:						Panel panel = new Panel();
    Line 148:						panel.Controls.Add(_viewState);
    Line 149:						Page.Form.Controls.Add(panel);
    Line 150:						string script = "document.getElementById('" + _viewState.ClientID + "').value = GetViewState__AspNetTreeView('" + Extender.MakeChildId("UL") + "');";
    Line 151:						Page.ClientScript.RegisterOnSubmitStatement(typeof(TreeViewAdapter), _viewState.ClientID, script);


    [HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
       System.Web.UI.ControlCollection.Add(Control child) +8696951
       CSSFriendly.TreeViewAdapter.SaveAdapterViewState() in E:\wwwroot\ThirdParty\CSSFriendly\CSSFriendly_24242\CSSFriendly\TreeViewAdapter.cs:149
       System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +8901848
       System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
       System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
       System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
       System.Web.UI.Control.SaveViewStateRecursive(ViewStateMode inheritedMode) +148
       System.Web.UI.Page.SaveAllState() +194
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2839
    



    I know its the cssfriendly adapters because the moment I exclude "CSSFriendlyAdapters.browser" from my VS2010 solution - the page works..


    Is there an updated version of the CSS friendly 24242? has anyone else came up with this problem?


    There is no <%%> in my master pages either....


    You guys are doing a great job..thanks




    Saturday, August 14, 2010 2:26 AM

All replies

  • User-1255549113 posted

    Thank you to who ever moved this thread.... <3 you heaps


    Tuesday, August 17, 2010 5:52 PM
  • User-1102123764 posted

    Hi,

    If you use something like 

    <head runat="server">
    <script type="text/javascript">
         var a=$get('<%=ControlID.ClientID%>');
    </script>
    </head> 

    Even these lines had been commented, please move them out of the <head> block and move them to the <body> block.

    Monday, September 6, 2010 9:47 PM