Copied to clipboard

Flag this post as spam?

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

  • Erik Foppen 20 posts 62 karma points
    Aug 29, 2016 @ 12:06
    Erik Foppen

    Content context or parent in new node

    Hi all,

    I am in need of a content context in my nupicker datatype to be passed to the macroviewpage.

    I have added contextId via parameters but that's only set in an existing node.

    Is there any way to see the parentid for a new node? Or is it just not possible?

    Thanks! Erik

  • Erik Foppen 20 posts 62 karma points
    Aug 29, 2016 @ 14:29
    Erik Foppen

    well of course in the case of a MacroViewPartial being called from nuPickers, there's a always a request object :)

    This does the job for me:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
        var contextContent = Umbraco.TypedContent(Model.MacroParameters["contextId"]);
        if (Model.MacroParameters["contextId"] == null)
            if (Request.QueryString["parentId"] != null)
                var parentContent = Umbraco.TypedContent(Request.QueryString["parentId"]);
                if (parentContent != null)
                    contextContent = parentContent;
Please Sign in or register to post replies

Write your reply to: