Copied to clipboard

Flag this post as spam?

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


  • Nisreen Al-Masri 12 posts 91 karma points
    Nov 09, 2017 @ 10:14
    Nisreen Al-Masri
    0

    Get Node ID for ( children) or (Macro parameters)

    Hello There!

    is there any easy direct way to get the node Id for current page children or any way to get the Ids for the macro parameters which came by content picker...

    I feel it is so easy question but I am stuck there

    Model.MacroParameters["page"]//it is give "umb://document/f875c2c828d04a2dbdb2dcf80d841a9f"

    but I am expecting Node= 1068

    Hope someone can help

    thanks

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Nov 09, 2017 @ 10:30
    Dan Diplo
    100

    Presumably what you actually want is the published content for the document, right? You can do this in the same way as you do for Ids, use the Umbraco helper eg.

    var content = Umbraco.TypedContent("umb://document/f875c2c828d04a2dbdb2dcf80d841a9f");
    

    So you can just pass the umb://document string to the helper and it does the work of converting.

    If you really need the Id you'd just get it from the content you get back from the helper eg.

    int id = content.Id;
    
  • Nisreen Al-Masri 12 posts 91 karma points
    Nov 09, 2017 @ 10:44
    Nisreen Al-Masri
    0

    as they said

    you are the Rock :)

    Thanks Daaaaaaaaaan :)

Please Sign in or register to post replies

Write your reply to:

Draft