Copied to clipboard

Flag this post as spam?

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


  • Rahmathullah 7 posts 85 karma points
    Sep 15, 2014 @ 13:44
    Rahmathullah
    0

    How to render a Macro inside another Macro

    Hi All,

    I quite new to umbraco and ran in to a problem. described below,

    What im trying to do :,

    Render an umbraco macro(asp.net user control) whithin anther macro(cshtml).

    i tried

    @foreach (var childPage in Model.NodeById(nodeId).Children.Where("Visible && FundID > 0")) { @Html.Raw(umbraco.library.RenderMacroContent("", Model.Id)) }

    Its not rendering the user control properly, ie, its like the page_load event of my user control is not working.

    http://our.umbraco.org/forum/developers/razor/22305-ASPNET-Usercontrol-inside-Razor-script here @Sebastiaan Janssen has said "Don't forget to surround your razor macro with

    though. :)" Dont know where to put the form tag.

     

     runat="server" language="cshtml">@{
    HtmlTextWriter writer = new HtmlTextWriter(this.Output);
    var navigation = new umbraco.presentation.templateControls.Macro();
    navigation.Alias = "Navigation";
    navigation.MacroAttributes.Add("ulclass", "art-vmenu");
    navigation.MacroAttributes.Add("level", 2);
    navigation.RenderControl(writer);   }

    I tried this method as well. but no hope. :(

    i've found 1 question similar to my situation, here. but no one answered yet.

    please help.

     

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Sep 15, 2014 @ 15:30
Please Sign in or register to post replies

Write your reply to:

Draft