Copied to clipboard

Flag this post as spam?

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


  • Owain Williams 482 posts 1414 karma points MVP 7x c-trib
    Jun 12, 2015 @ 14:19
    Owain Williams
    0

    How do I load a macropartial view from within a package?

    Hi, I have a sitenavigation macropartial which works fine on my main masterpage. I have a package installed within app_plugins\package\ and within that folder I have a masterpage for my package that I've installed.

    What I want to do is render the macropartial which is stored in \views\macropartials\siteNav.cshtml in my masterpage within app_plugins\package\themes\mytheme\views\master.cshtml

    When I type

    @Umbraco.RenderMacro("siteNav")
    

    I get an error : The type or namespace name 'RenderMacro' does not exist in namespace 'Umbraco'

    I tried adding

    @model Umbraco.Web.Macros.PartialViewMacroPage
    

    but then I am told I can only have one model per page.

    Any help would be great, Thanks,

  • James 251 posts 1169 karma points
    Jun 12, 2015 @ 15:18
    James
    0

    Maybe try :

    @umbraco.library.RenderMacro("siteNav")

    Hope this helps

    Cheers.

    J

  • Owain Williams 482 posts 1414 karma points MVP 7x c-trib
    Jun 13, 2015 @ 11:31
    Owain Williams
    0

    Thanks but RenderMacro gives an error 'umbraco.library' does not contain a definition for 'RenderMacro'

  • Owain Williams 482 posts 1414 karma points MVP 7x c-trib
    Jun 15, 2015 @ 09:48
    Owain Williams
    0

    Can anyone else offer a suggestion on how to call my global navigation partial from within a package?

    Thanks,

Please Sign in or register to post replies

Write your reply to:

Draft