Copied to clipboard

Flag this post as spam?

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


  • Martin 44 posts 66 karma points
    Feb 17, 2014 @ 19:00
    Martin
    0

    Render MVC Partial from MacroScript

    How do I render a MVC Partial from a MacroPartial?

    My MacroPartial (~/Views/MacroPartials/Contact.cshtml) looks like this:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    <div id="contact-wrapper">

    @Html.Partial("Contact")

    </div>

     

    My Contact view (~/Views/Partials/Contact.cshtml) looks like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    <p>Hello!</p>

     

    --

    This line causes the error: @Html.Partial("Contact")

    Error loading MacroEngine script (file: ~/Views/MacroPartials/Contact.cshtml)

     

    How do I make this work?

  • jivan thapa 194 posts 681 karma points
    Feb 17, 2014 @ 19:22
    jivan thapa
    0

    Have you tried @Umbraco.RenderMacro("Contact")

  • Martin 44 posts 66 karma points
    Feb 17, 2014 @ 21:16
    Martin
    0

    That doesnt work.
    It keeps loading itself, if I ask it to load itself (obviously) - causing an infinite loop.

    I would like my code to render a MVC Partial, not a Macro :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies