Copied to clipboard

Flag this post as spam?

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


  • Dmitriy 168 posts 588 karma points
    Oct 30, 2017 @ 08:03
    Dmitriy
    0

    Hello. I want to setup a 404-error page in the root of the site, and the page is using data from homepage (another root-page), so the question is how to get all root pages from other root-page and then use them?

    I use Siblings<TModel>() for now:

    var x = My404Page.Siblings<Home>();
    // do something with it... 
    
  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Oct 30, 2017 @ 08:43
    Alex Skrypnyk
    100

    Hi Dmitriy,

    Is it working for you?

    Also, you can use, it will return all root nodes:

    var rootNodes = Umbraco.TypedContentAtRoot().OfType<Home>();
    

    Thanks,

    Alex

  • Dmitriy 168 posts 588 karma points
    Oct 30, 2017 @ 09:04
    Dmitriy
    1

    Hi, Alex.

    Yes, it works, but not universal- it can't be used in any page, only in other root-page.

    var rootNodes = Umbraco.TypedContentAtRoot().OfType<Home>();
    

    Looks like what I want. Thanks a lot!

  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Oct 30, 2017 @ 12:08
    Alex Skrypnyk
    0

    You are welcome, Dmitriy

    Have a great day!

Please Sign in or register to post replies

Write your reply to:

Draft