Copied to clipboard

Flag this post as spam?

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


  • Robert 63 posts 282 karma points
    Apr 03, 2015 @ 13:38
    Robert
    0

    Load Partial View in a Marco

    Hi,

    Since there is a grid that allows us to load macro's inside the sections i have this question. We use Partials Views for every different part on a webpage, for example: Gallery is a partial view, employees is a partial view etc.

    But... Is there a way to load them into a macro so that it works and we can use them with the Grid?

    Kind regards, Robert

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 03, 2015 @ 13:49
    Dennis Aaen
    100

    Hi Robert,

    If I understand your question correctly, you are now using Partial views that you have created under the partial views folder in the settings section right?

    You can load a patial view in a macro by make a partial view macro. Go to the developer section and create a file in partial view macro files folder. You can use the same code from your patial views in the settings section. The different is that you can pass a parameter with the patial view macro, and it inherits from this

    @inherits Umbraco.Web.Macros.PartialViewMacroPage

    Instead of

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    Documentation can you find here: https://our.umbraco.org/documentation/Reference/Templating/Macros/Partial-View-Macros/ and https://our.umbraco.org/documentation/Reference/Templating/Mvc/views

    Hope this helps,

    /Dennis

  • Robert 63 posts 282 karma points
    Apr 03, 2015 @ 13:55
    Robert
    0

    OMG it works! :)

    This opens a whole new world! Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft