Copied to clipboard

Flag this post as spam?

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

  • kristian schneider 190 posts 351 karma points
    Mar 09, 2012 @ 16:53
    kristian schneider

    Rendering usercontrols in nested macros

    I have a question whether it is posible to render usercontrols properly in a nested macro.

    On my page I have razor macro that enumerates multiple nodes which again contains a RTE datatype. 

    On that datatype I have different content including usercontrol forms. 

    Now these forms renders ok with:

     @Html.Raw(umbraco.library.RenderMacroContent(box.GetPropertyValue("content"), Model.Id))

    And to some extend they get output correctly.

    The problem is that since they are usercontrols the aspnet callback functionality does not work right for example: 

    <input name="ApplyTravelerForm_12$FirstName" type="text" id="ApplyTravelerForm_12_FirstName" class="required">

    does not contain the entire control tree. I understand this is due to a limitation in the way umbraco renders the macro.

     /// Python and .ascx based macros will not render properly, as viewstate is not included.
            /// </summary>
            /// <param name="Text">The macro markup to be rendered.</param>
            /// <param name="PageId">The page id.</param>
            /// <returns>The rendered macro as a string</returns>
            public static string RenderMacroContent(string Text, int PageId)

    Is there no way of extending or hacking this so that the control becomes aware of its context and thereby working?


  • Henri Toivonen 77 posts 111 karma points
    Jun 28, 2012 @ 11:14
    Henri Toivonen

    I am wondering the same thing. How can this be solved in a somewhat elegant way?

    My problem is this, i have a macro that renders all content because of translations. It checks what language to render. Contour is inserted through RTE, and does not work.

    I am thinking of having a manually inserted iframe that shows a special contour page, but how to check what contour form to render. And having iframes doesn't feel right, just to get around this problem..

Please Sign in or register to post replies

Write your reply to: