Copied to clipboard

Flag this post as spam?

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


  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 05, 2017 @ 11:53
    ThomasBrunbjerg
    0

    Display content on page receiving content node id from query string

    I am in a situation where I want to display some content from a page that links to a "Booking" page, which receives the content node id of the page that linked it.

    So my URL might look like this: "booking?id=1160" , where the id refers to the content node that linked to the page.

    My question is how I can display content from this node on the booking page?

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Sep 05, 2017 @ 13:58
    Alex Skrypnyk
    1

    Hi Thomas

    You can render this page in the place where you want with Umbraco RenderTemplate method, example:

    Umbraco.RenderTemplate(pageId)
    

    Thanks,

    Alex

  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 06, 2017 @ 06:34
    ThomasBrunbjerg
    0

    Hi Alex

    Thanks, that worked for me.

    Is there a way to render a specific Umbraco field from the template? I want to display only the prices from the previous page on the booking page and not the whole template.

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Sep 06, 2017 @ 10:30
    Alex Skrypnyk
    1

    Hi Thomas, try this code:

    var node = Umbraco.TypedContent(pageId);
    var fieldValue = node.GetPropertyValue("specificFieldAlias");
    
  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Sep 08, 2017 @ 12:30
    Alex Skrypnyk
    0

    Hi Thomas

    Is it working for you? Share, please.

    Thanks,

    Alex

  • ThomasBrunbjerg 90 posts 182 karma points
    Sep 08, 2017 @ 12:57
    ThomasBrunbjerg
    100

    Hi Alex

    Sorry, I found another solution that worked for me.

    @Umbraco.Content(contentId).fieldAlias

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Sep 08, 2017 @ 13:03
    Alex Skrypnyk
    0

    Thanks for sharing.

    Have a great day!

Please Sign in or register to post replies

Write your reply to:

Draft