Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt Taylor 873 posts 2086 karma points
    May 22, 2013 @ 17:45
    Matt Taylor
    0

    Compatibility with uComponents RenderTemplate?

    I'm experiencing a problem with rendering a template within a template using the uComponents RenderTemplate control.

    You can see my doc types and templates structure below:

    From within the 'Home' template which inherits TemplateBase<DocumentTypes.HomePage> I am trying to use RenderTemplate to display a 'Rich Text Tile' node which uses a template that inherits TemplateBase<DocumentTypes.TileRichText>.

    But I'm getting the following error.

     

    Cannot convert document type 'TileRichText' to document type 'MetaOptions' or document type not found. Node id: '1107', node name: 'Why us?'

    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.Exception: Cannot convert document type 'TileRichText' to document type 'MetaOptions' or document type not found. Node id: '1107', node name: 'Why us?'

     


    [Exception: Cannot convert document type 'TileRichText' to document type 'MetaOptions' or document type not found. Node id: '1107', node name: 'Why us?']
       Vega.USiteBuilder.ContentHelper.GetByNode(Node node) +375
       Vega.USiteBuilder.TemplateBase`1.get_CurrentContent() +258
       ASP.masterpages_sitemaster_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) +55
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +12655789
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +12655789
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +12655789
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       umbraco.UmbracoDefault.Render(HtmlTextWriter writer) +99
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +12655789
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5363

     

    I'm not sure where it's picking the 'MetaOptions' DocType up from. As you can see from the structure above the 'TileRichText' doc type does not inherit from the 'MetaOptions' DocType and no templates associated with it reference it.

    Only the Home page itself which is containing the tile I'm trying to render use the 'MetaOptions' DocType further up the inheritence tree.

    I wondering that because there is not common inheritence between the two templates uSiteBuilder is causing the error?

  • Stephen 47 posts 270 karma points
    May 22, 2013 @ 22:03
    Stephen
    0

    TemplateBase.CurrentContent uses Node.GetCurrent() to determine the current node and gets the content based on that. I'm guessing that whatever RenderTemplate is doing, this will be returning the Homepage node when trying to render the template for the TileRichText node.

    Although, having looked at the code in TemplateRenderer.cs it does look to set the pageID context item that Umbraco uses to figure out the current page before rendering the template (I'm assuming you have the UseAspNetMasterPages still set to true?) so I'm not too sure without debugging it.

     

  • Matt Taylor 873 posts 2086 karma points
    May 23, 2013 @ 10:38
    Matt Taylor
    0

    Turns out the problem was a silly one and nothing to do with uSiteBuilder or RenderTemplates, even if the error did point in that direction.

    The 'TileMaster' master template for the 'TileRichRext' template that's used by the 'Tile RichText' document type I was trying to render with RenderTemplate did not have a ContentPlaceHolder but a just a Content section, silly cut and paste error.

    <asp:ContentPlaceHolder Id="contentPlaceHolder" runat="server">
    </asp:ContentPlaceHolder>

    Thanks for looking at it.

    Regards,

    Matt

  • Matt Taylor 873 posts 2086 karma points
    May 23, 2013 @ 12:50
    Matt Taylor
    100

    Yes it is compatible. :-)

Please Sign in or register to post replies

Write your reply to:

Draft