Copied to clipboard

Flag this post as spam?

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


  • Michael Falk 37 posts 59 karma points
    Jun 28, 2012 @ 17:14
    Michael Falk
    0

    Macro in Macro, 2nd not executing

    I have a Macro that generates a slider from several content pages by:

     

    <div id="slides">
        @foreach (var item in Model.SliderFolder.First().SliderPages)
        {
            <div class="slides_container">
                <div class="slide">
                    @Html.Raw(@item.bodyText.ToString())
                </div>
            </div>
        }
    </div>
    
    in one of the sliderpages another macro is inserted along with some static text. 
    It seems like the second macro is not executed. How can i achieve that?
    Any suggestion is very welcome :-)
    br
    Michael
  • Scott Williams 14 posts 71 karma points
    Jun 28, 2012 @ 17:46
    Scott Williams
    0

    try

    @Html.Raw(umbraco.library:RenderMacroContent(item.bodyText, item.Id))
    

    or you might have to use

    @Html.Raw(umbraco.library:RenderMacroContent(item.bodyText, Model.Id))

     

    richtext properties in Razor macros don't by default cause embeded macro to be run.

  • Michael Falk 37 posts 59 karma points
    Jun 28, 2012 @ 18:00
    Michael Falk
    0

    Thanks for the dats reply. this worked:

    <div id="slides">
        @foreach (var item in Model.SliderFolder.First().SliderPages)
        {
            <div class="slides_container">
                <div class="slide">
                @Html.Raw(umbraco.library.RenderMacroContent(item.bodyText.ToString(), item.Id));
                </div>
            </div>
        }
    </div>
Please Sign in or register to post replies

Write your reply to:

Draft