Copied to clipboard

Flag this post as spam?

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


  • Andrew Munro 78 posts 161 karma points
    Feb 25, 2013 @ 18:33
    Andrew Munro
    0

    RenderMacroContent not rendering UserControl macros

    Hey folks. I have a razor macro (RenderFullBlockContent.cshtml) that draws a standard layout for our site. Within this macro I have the following call to render any sub content (including macros)

    @Html.Raw(umbraco.library.RenderMacroContent(dBlockContent.blockContent.ToString(), Model.Id))

    This macro iterates through a nodes children and renders a property called blockContent on the page. In the past it has only rendered razor macros but we have recently started to move towards .Net UserControls.

    I attempted to create a UserControl macro and insert it into the property blockContent (rich text editor) but when I go to view the page I get the following error message:

    Error loading Razor Script RenderFullBlockContent.cshtml
    Error executing child request for handler 'Umbraco.Web.FormlessPage'.

    RenderFullBlockContent.cshtml seems to be having an issue rendering the UserControl macro that I've put on the page. Am I incorrect in assuming that RenderMacroContent can render UserControls? I figured I would be able to put a UserControl in the content and it would be no problem. Thanks in advance.

  • Sean 12 posts 32 karma points
    Mar 25, 2014 @ 12:36
    Sean
    0

    There is quite a long discussion about rending user controls inside razor on this thread, which may help

    http://our.umbraco.org/forum/developers/razor/22305-ASPNET-Usercontrol-inside-Razor-script

     

Please Sign in or register to post replies

Write your reply to:

Draft