Copied to clipboard

Flag this post as spam?

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


  • Anders Brohäll 295 posts 561 karma points c-trib
    Feb 11, 2014 @ 11:43
    Anders Brohäll
    0

    Render partial (Page) from inside a MacroPartial?

    How do i render PartialViews from inside MacroPartials?

    Example:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{
        var container = Umbraco.Content(Model.MacroParameters["personell"]);
    }
    @RenderPage("~/Views/Partials/PersonellListItems.cshtml", container)
    

    Is it possible? How?

  • Sebastiaan Janssen 5045 posts 15476 karma points MVP admin hq
    Feb 12, 2014 @ 09:02
    Sebastiaan Janssen
    0

    Just like "normal" MVC: @Html.Partial("~/Views/Partials/PersonellListItems.cshtml", container)

  • Lex Godthelp 15 posts 99 karma points
    Sep 20, 2017 @ 13:33
    Lex Godthelp
    0

    Hi Sebastiaan, do you know if this also works in 7.6? I'm having trouble loading a Partial from inside a MacroPartial.

    I've tried to use:

    @Html.Partial("poll")
    
    @{ Html.RenderPartial("poll") }
    
    @{ Html.RenderPartial("~/Views/Partials/poll.cshtml") }
    
    @Html.RenderPartial("~/Views/Partials/poll.cshtml")
    

    But they all don't seem to work. Do i have to add an inherit similar to @inherits Umbraco.Web.Macros.PartialViewMacroPage to the top of the page or something?

Please Sign in or register to post replies

Write your reply to:

Draft