+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / 4.1 upgrade issue: 4.0 custom content designer no longer works.

4.1 upgrade issue: 4.0 custom content designer no longer works.

13 posts, 0 answered
  1. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    Registered:
    13 Aug 2010
    19 Apr 2011
    Link to this post
    After upgrading to 4.1, I got the following error when I try to edit a content block:

    A required control was not found in the template for "~/Controls/ContentBlockDesignerTemplate.ascx". The control must be assignable from type "Telerik.Sitefinity.Web.UI.ControlDesign.ContentSelector" and must have ID "sharedContentSelector".

    I have a custom ContentBlockDesigner, basically a RadEditor with a few more buttons available than you normally see in Sitefinity. I assume that this message means that the old 4.0 method to override the editor now needs an extra control to interact with the 4.1 shared content block feature. Can someone let me know what that additional code should look like?

    Here's my ~/Controls/ContentBlockDesignerTemplate.ascx if you're interested, but it's basically implemented as suggested in a prior message thread.

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
       
    <sf:ResourceLinks id="resourcesLinks" runat="server">
        <sf:ResourceFile Name="Styles/Window.css" />
    </sf:ResourceLinks>
       
    <sf:FormManager ID="formManager" runat="server" />
    <div style="width: 660px; overflow: hidden;">
        <sf:HtmlField
            ID="htmlEditor"
            runat="server"
            Width="99%"
            Height="370px"
            EditorToolsConfiguration="Custom"
            EditorConfigurations="~/Controls/ToolsFile.xml"
            EditorToolsConfigurationKey="ToolsFile"
            DisplayMode="Write"
            FixCursorIssue="True">
        </sf:HtmlField>
    </div>
    <script type="text/javascript">
        $("body").addClass("sfContentBlockDesigner");
    </script>

    I'll disable my custom editor for now to work around the issue, but I it would be helpful to know what additional code is needed to override the editor in 4.1.

    Thank you!
    Dan
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    19 Apr 2011
    Link to this post
    Yeah, it would have changed...try this?

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" TagPrefix="designers" Namespace="Telerik.Sitefinity.Web.UI.ControlDesign" %>
     
    <sf:ResourceLinks id="resourcesLinks" runat="server">
        <sf:ResourceFile Name="Styles/Window.css" />
    </sf:ResourceLinks>
     
    <telerik:RadWindowManager
        ID="windowManager"
        runat="server"
        Behaviors="None"
        Skin="Sitefinity"
        ShowContentDuringLoad="false"
        VisibleStatusBar="false"
        VisibleTitleBar="true">
        <Windows>
            <telerik:RadWindow ID="contentPages" runat="server" Height="250" Width="425" Modal="true" NavigateUrl="~/Sitefinity/Dialog/ContentPagesDialog" ReloadOnShow="true" Behaviors="Close" />
            <telerik:RadWindow ID="preview" runat="server" Height="100" Width="100" Modal="true" NavigateUrl="~/Sitefinity/Dialog/ContentViewEditDialog?ControlDefinitionName=ContentBackend&ViewName=ContentBackendPreview&SuppressBackToButtonLabelModify=true" />
        </Windows>
    </telerik:RadWindowManager>
     
    <div id="selectorTag" style="display: none;" class="sfDesignerSelector sfFlatDialogSelector">
       <designers:ContentSelector
           ID="sharedContentSelector"
           runat="server"
           TitleText="<%$Resources:ContentResources, SelectSharedContentYouWantToUse %>"
           BindOnLoad="false"
           AllowMultipleSelection="false"
           WorkMode="List"
           SearchBoxInnerText=""
           ShowProvidersList="true"
           SearchBoxTitleText="<%$Resources:Labels, NarrowByTyping %>"
           ListModeClientTemplate="<span class='sfItemTitle'>{{Title}}</span><span class='sf_binderCommand_viewContentPages'>{{PagesCountUIString}}</span>">
       </designers:ContentSelector>
    </div>
    <sf:PromptDialog
        ID="shareContentDialog"
        Title="<%$ Resources:ContentResources, SharedContent %>"
        TextFieldTitle="<%$ Resources:ContentResources, Title %>"
        runat="server" 
        Width="350"
        Height="300"
        Mode="Input"
        AllowCloseButton="true"
        ShowOnLoad="false">
        <Commands>
            <sf:CommandToolboxItem Text="<%$ Resources:ContentResources, ShareThisContent %>" CommandName="shareContent" CommandType="SaveButton" WrapperTagName="LI" />
            <sf:CommandToolboxItem Text="<%$ Resources:Labels, Cancel %>" CommandName="cancel" CommandType="CancelButton" WrapperTagName="LI" />
        </Commands>
    </sf:PromptDialog>
     
    <sf:PromptDialog
        ID="unshareContentDialog"
        Message="<%$ Resources:ContentResources, AreYouSureYouWantToUnshareThisContent %>"
        runat="server" 
        Width="300"
        Height="300"
        Mode="Confirm"
        AllowCloseButton="true"
        InputRows="5"
        ShowOnLoad="false">
        <Commands>
            <sf:CommandToolboxItem Text="<%$ Resources:ContentResources, UnshareThisContent %>" CommandName="unshareContent" CommandType="NormalButton" WrapperTagName="LI" />
            <sf:CommandToolboxItem Text="<%$ Resources:Labels, Cancel %>" CommandName="cancel" CommandType="CancelButton" WrapperTagName="LI" />
        </Commands>
    </sf:PromptDialog>
     
    <sf:FormManager ID="formManager" runat="server" />
    <div id="editView" class="sfContentBlocksDesignerWrp">
        <sf:HtmlField
            ID="htmlEditor"
            runat="server"
            Width="99%"
            Height="370px"
            EditorContentFilters="DefaultFilters"
            EditorStripFormattingOptions="MSWord,Css,Font,Span,ConvertWordLists"
            DisplayMode="Write"
            FixCursorIssue="True">
        </sf:HtmlField>
        <sf:CommandBar id="editViewCommandBar" runat="server" WrapperTag="div" WrapperCssClass="sfContentBlocksBtnAreaBottom">
            <Commands>
                <sf:CommandToolboxItem runat="server" CommandName="selectSharedContent" CommandType="NormalButton" CssClass="sfChange" Text="<%$Resources:ContentResources, SelectFromExistingSharedContent %>" />
                <sf:CommandToolboxItem runat="server" CommandName="shareContent" CommandType="NormalButton" CssClass="sfChange" Text="<%$Resources:ContentResources, ShareThisContentAcrossPages %>" />
            </Commands>
        </sf:CommandBar>
    </div>
    <div id="previewAndEditContentView" class="sfContentBlocksDesignerWrp">
        <div class="sfNeutral sfClearfix">
            <asp:Label ID="sharedContentLabel" runat="server" Text="<%$Resources:ContentResources, ThisContentIsShared %>"></asp:Label>
            <asp:HyperLink ID="viewPagesLink" runat="server" NavigateUrl="javascript:void(0);" CssClass="">
                <asp:Literal ID="viewPagesLiteral" runat="server" Text="<%$Resources:ContentResources, ViewAffectedPages %>" />
            </asp:HyperLink>
            <div id="editOutDatedContentView">
                <span class="sfFailure">
                    <asp:Literal ID="newerVersionLabel1" runat="server" Text="<%$Resources:ContentResources, ThereIsNewerVersionOfThisContent %>" />
                    <asp:HyperLink ID="previewLink" runat="server" NavigateUrl="javascript:void(0);" CssClass="">
                        <asp:Literal ID="previewLiteral" runat="server" Text="<%$Resources:Labels, Preview %>" />
                    </asp:HyperLink>
                    <asp:Literal ID="orLabel" runat="server" Text="<%$Resources:Labels, or %>" />
                    <asp:HyperLink ID="updateLink" runat="server" NavigateUrl="javascript:void(0);" CssClass="">
                        <asp:Literal ID="updateLiteral" runat="server" Text="<%$Resources:Labels, Update %>" />
                    </asp:HyperLink>
                    <asp:Literal ID="newerVersionLabel2" runat="server" Text="<%$Resources:ContentResources, WithTheNewerVersion %>" />
                </span>
            </div>
     
            <sf:CommandBar id="commandBar" runat="server" WrapperTag="div" WrapperCssClass="sfContentBlocksBtnAreaTop">
                <Commands>
                    <sf:CommandToolboxItem runat="server" CommandName="editContent" CommandType="NormalButton" CssClass="sfChange" Text="<%$Resources:ContentResources, EditThisContent %>" />
                    <sf:CommandToolboxItem runat="server" CommandName="unshareContent" CommandType="NormalButton" CssClass="sfChange" Text="<%$Resources:ContentResources, Unshare %>" />
                </Commands>
            </sf:CommandBar>
        </div>
        <sf:SitefinityLabel id="contentLabel" runat="server" WrapperTagName="div" CssClass="sfSharedContentPreviewWrp"></sf:SitefinityLabel>
        <sf:HtmlField
            ID="contentEditor"
            runat="server"
            Width="99%"
            Height="370px"
            EditorContentFilters="DefaultFilters"
            EditorStripFormattingOptions="MSWord,Css,Font,Span,ConvertWordLists"
            DisplayMode="Write"
            FixCursorIssue="True">
        </sf:HtmlField>
    </div>
     
    <sf:ClientLabelManager id="clientLabelManager" runat="server">
      <Labels>
        <sf:ClientLabel ClassId="ContentResources" Key="ThisContentIsShared" runat="server" />
        <sf:ClientLabel ClassId="ContentResources" Key="ThisContentIsSharedAccross" runat="server" />
        <sf:ClientLabel ClassId="ContentResources" Key="ViewAffectedPages" runat="server" />
        <sf:ClientLabel ClassId="PageResources" Key="Page" runat="server" />
        <sf:ClientLabel ClassId="PageResources" Key="Pages" runat="server" />
        <sf:ClientLabel ClassId="Labels" Key="Back" runat="server" />
        <sf:ClientLabel ClassId="Labels" Key="SaveChanges" runat="server" />
        <sf:ClientLabel ClassId="Labels" Key="Save" runat="server" />
      </Labels>
    </sf:ClientLabelManager>
     
    <script type="text/javascript">
        $("body").addClass("sfContentBlockDesigner");
    </script>
  3. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    22 Apr 2011
    Link to this post
    Hi Steve,

    The error you get is thrown when parsing the template for your custom designer. We've switched to a virtual path provider in 4.1 and the old way of defining the template for your custom controls - although working in many cases - is now obsolete. I've written a blog post describing how to make your custom control work with this new feature, which you can read here. Please apply those changes and let me know if the problem is not resolved.

    Best wishes,
    Slavo
    the Telerik team

  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    22 Apr 2011
    Link to this post
    Hey Slavo,
      It's not me who had the issue, it's dan...

    But I don't think that's what his problem is.  He has an external view mapped to the Html control and you guys added in the shared content bits which it can't now find in his template.


    A required control was not found in the template for "~/Controls/ContentBlockDesignerTemplate.ascx". The control must be assignable from type "Telerik.Sitefinity.Web.UI.ControlDesign.ContentSelector" and must have ID "sharedContentSelector".
  5. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    Registered:
    13 Aug 2010
    22 Apr 2011
    Link to this post
    Slavo,

    I *think* that Steve is on the right track. I haven't had time to implement the long fix. So for now, I removed the custom HTML editor (RadEditor with extra toolbar buttons). Now we're back to Sitefinity's basic HTML editor. As soon as I get time, I'd like to add more buttons back into RadEditor. I just need to know if 4.1 requires additional things in the ContentBlockDesignerTemplate to make it work.

    Thanks,
    Dan
  6. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    22 Apr 2011
    Link to this post
    FYI, that fix worked for me Dan (same issue) ;)

    The backend code (SimpleView?) references controls on the template it's mapped to.  You've set the external template to be in your root.

    So this "A required control was not found in the template"

    Denotes that it FOUND the external template, it just cant find a control anywhere there with the ID of "sharedContentSelector" which makes sense since that is a new control in this view as of 4.1.

    Had it not found the template you'd be getting an entirely different YSOD with some sort of generic cant find layout template error...
  7. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    Registered:
    13 Aug 2010
    22 Apr 2011
    Link to this post
    Steve,

    Just clarifying an ambigutiy, when you say, 'that fix worked', were you talking about your posted fix, or Slavo's?

    Thanks,
    Dan
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    22 Apr 2011
    Link to this post
    Mine worked ;)

    Slavos fix is for custom widget layouts...not external template mapping
  9. Richard
    Richard avatar
    63 posts
    Registered:
    20 Jan 2010
    10 May 2011
    Link to this post
    Hi Guys,
    After upgrading this afternoon I am also having the exact same issue as Dan. I have added the code that Steve provided to get the original editor back but I cannot attach my ToolsFile.xml.

    Basically all I want to do is add back my custom css classes as a dropdown.

    My original code is below:

    ContentBlockDesignerTemplate

    <%@ Control Language="C#" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" TagPrefix="sf" %>
     
       
    <sf:ResourceLinks id="resourcesLinks" runat="server">
        <sf:ResourceFile Name="Styles/Window.css" />
    </sf:ResourceLinks>
     
    <sf:FormManager ID="formManager" runat="server" />
    <div style="width: 660px; overflow: hidden;">
        <sf:HtmlField
            ID="htmlEditor"
            runat="server"
            Width="99%"
            Height="370px"
            EditorToolsConfiguration="Custom"
            EditorConfigurations="~/Controls/ToolsFile.xml"
            EditorToolsConfigurationKey="ToolsFile"
            DisplayMode="Write"
            FixCursorIssue="True">
        </sf:HtmlField>
    </div>
    <script type="text/javascript">
        $("body").addClass("sfContentBlockDesigner");
    </script>

    ToolsFile.xml

    <root>
        <cssFiles>
            <item name="~/Controls/CustomClasses.css" />
        </cssFiles>
        <tools name="MainToolbar" dockable="false">
            <tool name="Bold" shortcut="CTRL+B"/>
            <tool name="Italic" shortcut="CTRL+I"/>
            <tool name="JustifyLeft" />
            <tool name="JustifyCenter" />
            <tool name="JustifyRight" />
            <tool name="JustifyFull" />
            <tool name="InsertOrderedList" />
            <tool name="InsertUnorderedList" />
            <tool name="InsertTable" />
            <tool separator="true"/>
            <tool name="Undo" shortcut="CTRL+Z"/>
            <tool name="Redo" shortcut="CTRL+Y"/>
            <tool separator="true"/>
            <tool name="ImageManager" text="Insert an image"/>
            <tool name="DocumentManager" text="Insert a document"/>
            <tool name="LinkManager" text="Insert a link" shortcut="CTRL+K"/>
            <tool name="Unlink" shortcut="CTRL+SHIFT+K"/>
            <tool name="FlashManager"/>
            <tool name="MediaManager"/>
            <tool separator="true"/>
            <tool name="AjaxSpellCheck" shortcut="F7"/>
            <tool name="PasteFromWordNoFontsNoSizes" />
            <tool name="PastePlainText" />
            <tool separator="true"/>
            <tool name="ApplyClass" />
            <tool name="FormatStripper"/>
            <tool separator="true"/>
        </tools>
    </root>

    Any help would be greatly appreciated.
    thanks
    Richard
  10. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    10 May 2011
    Link to this post
    What if instead of mapping to this View...what if you go to a Lower level and map the HtmlField View external.  That way you can directly modify the RadEditor itself?
  11. Richard
    Richard avatar
    63 posts
    Registered:
    20 Jan 2010
    10 May 2011
    Link to this post
    Any pointers on how I can do this Steve?

    Do we know if there has been any updates in the latest version to make this easier like it was in v3.7?
  12. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    10 May 2011
    Link to this post
    I have a copy of that view somewhere here I think I can dig up

    Q2 will allow you to tweak all these things in the Admin area, so you wont need external views...so a fix is coming ;)
  13. Ben
    Ben avatar
    3 posts
    Registered:
    28 Sep 2012
    09 Feb 2012
    Link to this post
    Steve. You da man!!  The code you posted on 4/19/11 above worked for me on version 4.2.1733.0.  I have been trying to fix this for about 6 hours!!! So thank you!!!
13 posts, 0 answered