More in this section

Forums / Developing with Sitefinity / Generic Content in User Control and the IContentContainer in 3.6

Generic Content in User Control and the IContentContainer in 3.6

24 posts, 0 answered
  1. nogatek
    nogatek avatar
    35 posts
    Registered:
    23 Apr 2008
    23 Feb 2009
    Link to this post
    Hi,

    Since upgrading to SF 3.6 (from 3.2) I'm getting the following error (see below).

    The code behind I've included was sample code provided to us from support that enabled embedding generic content in our own user control.

    Is there a new way we should be doing this now?

    Thanks, Mark

    Errors:

    Error    102    Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)    D:\Visual Studio 2008\Projects\Navon\UserControls\Other\Testimonial.ascx.cs    35    35    D:\...\Navon\

    Warning    103    'Telerik.Cms.IContentContainer' is obsolete: 'Use Telerik.Framework.Web.Design.ControlDesigner instead.'    c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\navon\b44e827b\427f5d5c\App_Web_testimonial.ascx.a861f1fd.yabm3vhk.0.cs    14    

    User control markup (Testimonial.ascx.cs):

    <sfWeb:GenericContent runat="server" ID="GenericContent1" />

    Code behind:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Telerik.Cms;
    using Telerik;
    using Telerik.Cms.Engine.WebControls;
    using System.ComponentModel;
    using Telerik.Cms.Web.UI;

    public partial class UserControls_ExtGenericContent : System.Web.UI.UserControl, IContentContainer
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        #region IContentContainer Members

        [Browsable(false)]
        [WebEditor("Telerik.Cms.Engine.WebControls.HtmlContentEditor, Telerik.Cms.Engine")]
        [TypeConverter(typeof(StringConverter))]
        public object Content
        {
            get
            {
                return this.GenericContent1.Content;
            }
            set
            {
                this.GenericContent1.Content = value;
            }
        }

        public string ProviderName
        {
            get
            {
                return this.GenericContent1.ProviderName;
            }
            set
            {
                this.GenericContent1.ProviderName = value;
            }
        }
        #endregion
    }  



  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    23 Feb 2009
    Link to this post
    Hello Mark,

    To solve the issue, follow the instructions below:

    1. Modify the Content property of the User Control:

    [Browsable(false)] 
        [WebEditor("Telerik.Cms.Engine.WebControls.HtmlContentEditor, Telerik.Cms.Engine")] 
        [TypeConverter(typeof(StringConverter))] 
        public object Content 
        { 
            get 
            { 
                return this.GenericContent1.Content; 
            } 
            set 
            { 
                this.GenericContent1.Content = (string)value
            } 
        } 

    2. Map Telerik.Cms.Engine.WebControls.HtmlContentEditor control to use an external template:
        - Create a new directory in the App_Data directory and name it Configuration.
       - Create a new file in the Configuration directory and name it Telerik.Sitefinity.Configuration.ControlsConfig.xml.
       - Set the following XML in the file
    :

    <?xml version="1.0" encoding="utf-8"?> 
    <controlsConfig> 
      <viewMap> 
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.HtmlContentEditor" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx" /> 
      </viewMap> 
    </controlsConfig> 

    Thus, you will map HtmlContentEditor control to use ~/Sitefinity/Admin/ControlTemplates/Generic_Content/EditorTemplate.ascx external template.

       - Extract the files from the attachment in the corresponding folders (EditorTemplate.ascx file should be placed in ~/Sitefinity/Admin/ControlTemplates/Generic_Content/ folder, while the resource file should be put in ~/Sitefinity/Admin/ControlTemplates/Generic_Content/App_LocalResources/ folder).

    Do let us know if this helps.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Craig
    Craig avatar
    8 posts
    Registered:
    16 May 2008
    25 Feb 2009
    Link to this post
    This works to an extent.

    However, when inserting an image into a content area - and then attempting to SAVE changes, we recieve this error message:

    Server Error in '/' Application. 
    No default implementation for retrieving item URL yet. Please use delegate to handle retrieval. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
     
    Exception Details: System.NotImplementedException: No default implementation for retrieving item URL yet. Please use delegate to handle retrieval. 
     
    Source Error: 
     
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
     
    Stack Trace: 
     
    [NotImplementedException: No default implementation for retrieving item URL yet. Please use delegate to handle retrieval.] 
       Telerik.Cms.Web.LinkParser.Resolve(HtmlChunk chunk, Int32 valueIndex, GetItemUrl itemUrl, ResolveUrl resolveUrl, Boolean preserveOriginalValue, Boolean resolveAbsolute) +691 
       Telerik.Cms.Web.LinkParser.ParseHtml(String html, GetItemUrl itemUrl, ResolveUrl resolveUrl, Boolean resolve, Boolean preserveOriginalValue, Boolean resolveAbsolute) +416 
       Telerik.Cms.Web.LinkParser.ResolveLinks(String html, Boolean preserveOriginalValue, Boolean resolveAsAbsoluteUrl) +55 
       Telerik.Cms.Engine.WebControls.HtmlContentEditor.EditValue(String value) +1044 
       Telerik.Cms.Web.UI.WebUITypeEditor`1.Telerik.Cms.Web.UI.IWebUITypeEditor.EditValue(Object value) +82 
       Telerik.Cms.Web.UI.ControlEditor.CreateChildControls() +1493 
       System.Web.UI.Control.EnsureChildControls() +87 
       System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +23 
       System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +327 
       System.Web.UI.Page.FindControl(String id) +38 
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +113 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 
     
     
    Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053  

    Is there a workaround for this?

    Thanks

    --
    Craig.
  4. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    27 Feb 2009
    Link to this post
    Hello Craig,

    Currently, there is no default implementation for retrieving the URL of the content item depending on its ID. So, to solve the issue, you need to go in HTML mode of the editor and manually delete the value of  the sfref attribute in the <img> tag. This will be fixed in the upcoming service pack.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    03 Mar 2009
    Link to this post
    Hi,

    System.ArgumentException: The key "SharedContentInfo" is notdefined for resource "Telerik.Cms.Engine.Resources.Messages"
    atTelerik.Cms.Web.UI.Templates.Attribute.GetValue(SubstitutionItem subst, Objectcomponent, Control bindingContainer)
    atTelerik.Cms.Web.UI.Templates.Attribute.GetValue(PropertyDescriptor descriptor,Object component, Control bindingContainer)
    atTelerik.Cms.Web.UI.Templates.Attribute.SetAttribute(Object component, ControlbindingContainer, Boolean bound)
    atTelerik.Cms.Web.UI.Templates.Attribute.SetAttribute(Object component, ControlbindingContainer)
    atTelerik.Cms.Web.UI.Templates.ObjectBuilder.CreateObject(ControlbindingContainer)
    atTelerik.Cms.Web.UI.Templates.ControlBuilder.CreateControl(ControlbindingContainer)
    atTelerik.Cms.Web.UI.Templates.RootBuilder.CreateChildControls(Control parent,Control bindingContainer)
    atTelerik.Cms.Web.UI.Templates.ObjectBuilder.CreateObject(ControlbindingContainer)
    atTelerik.Cms.Web.UI.Templates.ControlBuilder.CreateControl(ControlbindingContainer)
    atTelerik.Cms.Web.UI.Templates.RootBuilder.CreateChildControls(Control parent,Control bindingContainer)
    atTelerik.Framework.Web.ControlUtils.StringTemplate.InstantiateIn(Controlcontainer)
    atTelerik.Cms.Engine.WebControls.HtmlContentEditor.get_Container()
    atTelerik.Cms.Engine.WebControls.HtmlContentEditor.get_Editor()
    atTelerik.Cms.Engine.WebControls.HtmlContentEditor.CreateChildControls()
    atSystem.Web.UI.Control.EnsureChildControls()
    atTelerik.Cms.Engine.WebControls.HtmlContentEditor.EditValue(String value)
    atTelerik.Cms.Web.UI.WebUITypeEditor`1.Telerik.Cms.Web.UI.IWebUITypeEditor.EditValue(Objectvalue)
    at Telerik.Cms.Web.UI.ControlEditor.CreateChildControls()
    atSystem.Web.UI.Control.EnsureChildControls()
    atSystem.Web.UI.WebControls.CompositeControl.RecreateChildControls()
    atTelerik.Cms.Web.UI.ControlEditor.Select(Guid controlId, String defClientId)
    at Admin_CtrlProps.Page_Load(Object sender, EventArgs e) inc:\webs\mysite.com\Sitefinity\Admin\CtrlProps.aspx.cs:line18
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Objecto, Object t, EventArgs e)
    atSystem.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgse)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    atTelerik.Cms.Web.CmsPageBase.OnLoad(EventArgs e)
    atSystem.Web.UI.Control.LoadRecursive()
    atSystem.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

    Any thoughts on this?

  6. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    03 Mar 2009
    Link to this post
    Sorry, thought I wrote some details on that... must have gotten sucked up in a paste :).  What I meant to say is I set up my code in this exact way, and I get this exception when I open the Edit window for the control.  Any thoughts?
  7. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    04 Mar 2009
    Link to this post
    Hi John,

    Please, refer to my first post in this thread. It describes in details how to solve "The key 'SharedContentInfo' is not defined..." error. What you you need to do is map Telerik.Cms.Engine.WebControls.HtmlContentEditor control to use an external template.

    Do let us know if this helps.

    Greetings,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    05 Mar 2009
    Link to this post
    Hi Pepi,

    I followed your exact instructions, but I am still getting that error.  Is there something I am missing?  It seems as if the linking being done in the XML file is not being recognized.

    Thanks,
    John
  9. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    06 Mar 2009
    Link to this post
    Hi John,

    Which version of Sitefinity are you running? Note that in the official release of v3.6, the external templates do not work properly. Anyway, if you use Sitefinity 3.6 Hotfix, send us the following files to debug the issue locally:
    1. The configuration file.
    2. The external template and its resource file.
    3. The user control implementing IContentContainer interface

    Thanks for your cooperation in advance.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    06 Mar 2009
    Link to this post
    Hi,

    I had the base 3.6 installation in place.  Installing the 3.6 hotfix fixed this.  Thanks!

    John
  11. Connections Academy Developer
    Connections Academy Developer avatar
    151 posts
    Registered:
    04 May 2005
    09 Mar 2009
    Link to this post
    This blog post claims our updates to templates will be "update-safe":


    Yet this file:

    Sitefinity/Admin/ControlTemplates/Pages/Dialogs/LinksEditorDialog.ascx

    Had changes in it in your last hotfix.  So, can we make changes to our own templates and not have to worry about future upgrades or not?  I thought you were using embedded templates?     I haven't specfied anything specifically in the ControlsConfig file, yet this file (LinksEditorDialog.ascs) is what is used to edit Hyperlinks.
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Mar 2009
    Link to this post
    Hi,

    You are right, the dialog templates are still not embedded. They will be embedded with 4.0.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  13. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    11 Mar 2009
    Link to this post
    Hi,

    Going back to the Generic Content-embedding control conversation...

    I am seeing some odd behavior between the Content and Properties tabs of the control, using the exact code in the example above.  I see the Content tab with the RadEditor, and the Properties tab with additional properties (i.e. ID, Visible, EnableViewstate, etc.).  If I do the following:

    1. Drag the control onto a page and edit it for the first time.

    2. Add some content in the RadEditor.

    3. Go to the Properties tab.

    What I see at this point is that the Content tab still appears to be selected, even though I am seeing the items on the properties tab.  Then, if I click the Content tab again, it won't go back.  It gets stuck.  This only appears to happen if I add/change the editor content, then go to the Properties tab.  If I open the editing window for the control, and change nothing at all, I can freely click back and forth between tabs.  Are you able to see this happen using the exact code described above, with the 3.6 hotfix installed?  Either way, any ideas what could be going on?

    Thanks,
    John
  14. John
    John avatar
    21 posts
    Registered:
    25 Nov 2008
    11 Mar 2009
    Link to this post
    Please note: I am using IE7.  I have reports that the same issue happens in IE6, and it is in fact worse there: even if you DON'T change any content in the editor, when you go to the Properties tab, you get stuck there.
  15. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Mar 2009
    Link to this post
    Hi John,

    I was not able to reproduce this behavior either with IE6 and IE7. I used the default template (Blue with right side bar theme). Could you please check if you get the same behavior with the default templates and CSS files? If yes, then the problem should be in the styles. You could send us your masterpage and all related files to the theme, so we can see what could be the problem.

    Best wishes,
    Georgi
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  16. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    15 Apr 2009
    Link to this post
    Was this explained in the KB article "How to wrap a GenericContent control"

    If so, the different between wrapping a GenericContent control before 3.6 and after is quite different.  The article is confusing and could really use some clarification or be an upcoming webinar.  I would imagine that building controls that wrap the GenericContent control would be highly used by most people.

    Is this process explained a little better anywhere else?

    Thank you!
  17. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    16 Apr 2009
    Link to this post
    Has there been any resolution to this? I have the same situation where  Content tab still appears to be selected, even though I am seeing the items on the properties tab.  Then, if I click the Content tab again, it won't go back.  It gets stuck.  
  18. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Apr 2009
    Link to this post
    Hi Laura,

    Are you using the latest 3.6 hotfix version? Also, I believe the following KB Article would be helpful:
    How to wrap a GenericContent control.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  19. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    05 Aug 2009
    Link to this post
    Thanks for the update, this seems to answer these questions, if however with a method that requires a fairly major rewrite of old controls.

    But the question arrises, why did you break the previous method, it was simple, effective and overall well suited to the task of simply adding a rich content to a toolbox usercontrol.

    The new method however is less useful, and overly complicated. I also see immediately a draw back. By inheriting from the GenericContent class, rather than implementing an interface, you lose the ability to extend a base control and add rich content to the control, where the old method did this gracefully.
  20. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 Aug 2009
    Link to this post
    Hi Nigel,

    The change happen after we changed the templating of the controls. Since we use the embedded ones now, we had to make some changes.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  21. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    05 Aug 2009
    Link to this post
    Hi, mostly on this topic, I have has a number of controls that would benifit from the capability of having numerous rich content properties. A simple example of this is my Contact Form Control, that lets the end user edit both the admin side email template, and the public reply email template. Is there a way to use the Property editor to 'drill down' to these properties and display the Rad Editor, or would I need to write a Designer to handle these cases.

    Thanks
    Nigel
  22. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    06 Aug 2009
    Link to this post
    Also, after applying the change to my control, I am now getting an error message.

    Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.

    Source Error:

    Line 399:                    if (!this.Controls.Contains(this.Container))
    Line 400: {
    Line 401: this.Container.RenderControl(writer);
    Line 402: }
    Line 403: }

    Source File: C:\Project Files\IC-Solutions\SiteFinity\ToolBoxControls\IC-Solutions.SiteFinity.ToolBoxControls\GenericContent\TextScroller.cs    Line: 401

    Stack Trace:

    [InvalidOperationException: Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.]
    Telerik.Web.UI.ScriptRegistrar.GetScriptManager(Control control) +173
    Telerik.Web.UI.RadDataBoundControl.get_ScriptManager() +15
    Telerik.Web.UI.RadDataBoundControl.RegisterScriptDescriptors() +26
    Telerik.Web.UI.RadDataBoundControl.Render(HtmlTextWriter writer) +104
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    IC_Solutions.SiteFinity.ToolBoxControls.GenericContent.TextScroller.Render(HtmlTextWriter writer) in C:\Project Files\IC-Solutions\SiteFinity\ToolBoxControls\IC-Solutions.SiteFinity.ToolBoxControls\GenericContent\TextScroller.cs:401
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
    System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
    System.Web.UI.Adapters.ControlAdapter.Render(HtmlTextWriter writer) +21
    Telerik.Cms.Web.FormAdapter.Render(HtmlTextWriter writer) +142
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +8681769
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
    System.Web.UI.Page.Render(HtmlTextWriter writer) +29
    Telerik.Web.UI.RadAjaxPage.Render(HtmlTextWriter writer) +43
    Telerik.Cms.Web.CmsPageBase.Render(HtmlTextWriter writer) +460
    Telerik.Cms.Web.InternalPage.Render(HtmlTextWriter writer) +439
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

    Obviously this control is on a page in sitefinity, and ofcourse is been rendered as part of a request. Do you have any hints, ideas where this error might be coming from?

    The Control that is been rendered when this error is thrown is a RadRotator, and the contents of the GenericContent is been used as the layout template (simple string replacement) for the Rotators contents which has a literal control that is databound to this text. This was working great with the IGenericContent method (Except of course for the known issues that this implementation has in 3.6)

    [EDIT]
      Just for clarification this works fine when in edit mode, but in preview mode the same error occurs (which is to be expected)

    On closer inspection Contaner.Page is null, as with a lot of other attributes that you would expect the framework to be setting.
    [/EDIT]
  23. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    06 Aug 2009
    Link to this post
    Ok, I have got this to work by changing the described Container Property to the following:

            [Browsable(false)]
            protected virtual GenericContainer Container
            {
                get
                {
                    if (this.container == null)
                    {
                        this.container = new GenericContainer();
                        Controls.Add(container);
                        if (this.LayoutTemplate != null)
                        {
                            this.LayoutTemplate.InstantiateIn(this.container);
                            
                        }
                    }
                    return this.container;
                }
            }

    By adding the container to the controls collection the context properties (page etc) are set.
  24. Nigel
    Nigel avatar
    49 posts
    Registered:
    07 Jul 2008
    06 Aug 2009
    Link to this post
    Ok, conversion problems continue. Now the page renders without exception, however all functionality of the RadRotator are lost. Instead of displaying just one of the items and scrolling through the others it is displaying them all. Guessing from looking at the source, that the stylesheets are not been registered, or the javascript is not firing correctly. Source output below:

    <div id="ctl00_TopTextContent_ctl00_RadRotator1" class="RadRotator RadRotator_Black " style="height:100px;width:600px;">
    	<div class="rrRelativeWrapper">
    <div class="rrClipRegion">
    <ul class="rrItemsList">
    <li class="rrItem"><div id="ctl00_TopTextContent_ctl00_RadRotator1_i0">
    <span class="scroller_headline">My Second new article</span> <span class="scroller_content">This is my second news article and it is here for the fun of my testing</span>

    </div></li><li class="rrItem"><div id="ctl00_TopTextContent_ctl00_RadRotator1_i1">
    <span class="scroller_headline">My first news item</span> <span class="scroller_content"></span>
    				</div></li>
    </ul>
    </div><a class="rrButton rrButtonUp" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonLeft" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonRight" href="javascript:void(0);">&nbsp;</a><a class="rrButton rrButtonDown" href="javascript:void(0);">&nbsp;</a>
    </div><input id="ctl00_TopTextContent_ctl00_RadRotator1_ClientState" name="ctl00_TopTextContent_ctl00_RadRotator1_ClientState" type="hidden" />
    </div>
    </div>

    .....
    Sys.Application.add_init(function() {
    $create(Telerik.Web.UI.RadRotator, {"clientStateFieldID":"ctl00_TopTextContent_ctl00_RadRotator1_ClientState","items":[{},{}],"scrollDirection":4,"skin":"Black","slideShowAnimationSettings":{"type":2,"duration":500}}, null, null, $get("ctl00_TopTextContent_ctl00_RadRotator1"));
    });


    Interestingly, the implementation that uses RadTicker is working fine...
Register for webinar
24 posts, 0 answered