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

Error in editmode

1 Answer 64 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
anders
Top achievements
Rank 1
anders asked on 16 Sep 2009, 08:21 AM
Hi,
I have a simple pagelayout

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

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

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

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

</asp:Content>
<----------- 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?

1 Answer, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 18 Sep 2009, 08:25 AM
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.

Regards,
Stanimir
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.
Tags
WebParts for SharePoint
Asked by
anders
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or