Error in editmode

2 posts, 0 answers
  1. anders
    anders avatar
    2 posts
    Member since:
    Oct 2008

    Posted 16 Sep 2009 Link to this post

    I have a simple pagelayout

    <----------- PAGELAYOUT ----------->

    <%@ Page language="C#"  ....
    <%@ Register TagPrefix="Telerik" Namespace="Telerik.SharePoint.FieldEditor" Assembly="RadEditorSharePoint, Version=, Culture=neutral, PublicKeyToken=1f131a624888eeed" %>

    <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">

     <Telerik:RadHtmlField FieldName="PublishingPageContent" runat="server" InputFieldLabel="Body" id="RichHtmlField"/>

    <----------- PAGELAYOUT ----------->

    When in displaymode it works fine, but when i go in edit mode I get the following exception:
     The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
    And the stack trace:

    [HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
       System.Web.UI.ControlCollection.Add(Control child) +11013946
       Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl _control) +1116
       Telerik.Web.UI.RadEditor.OnPreRender(EventArgs e) +16
       Telerik.SharePoint.MOSSRadEditor.OnPreRender(EventArgs e) +54
       System.Web.UI.Control.PreRenderRecursiveInternal() +108

    The solution deployment and feature activation is done without errors. Any ideas on what can cause this behavior?

  2. Stanimir
    Stanimir avatar
    1653 posts

    Posted 18 Sep 2009 Link to this post

    Hi Anders,

    This error happens when a control on the page tries to modify the controls collection of another control while the other control contains <%=%> blocks.

    RadEditor renders the references to its css files to the <head> element of the page in order to not break the page Xhtml compliance.

    Can you please, check if you have some code (a script tag, etc) in the page head?
    If so, you can safely move your script outside the head element, for example to the page body.

    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