Copied to clipboard

Flag this post as spam?

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


  • Madeline Wilborn 1 post 71 karma points
    Jan 13, 2021 @ 07:22
    Madeline Wilborn
    0

    Umbraco data problem

    I try to use the Umbraco 8 documentation but some things do not work for me. I took the following lines from the Umbraco documentation but the Content object does not exist:

    @{
    var site = Model.Content.Site();
    var doThis = Umbraco.TypedContent(123);
    }
    

    I also tried to access the content directly from database but again I had the same result:

    @{
    var dontDoThis = ApplicationContext.Services.ContentService.GetById(123);
    }
    

    Do I have to add a reference or a using in my view?

    Thanks in advance for your help.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jan 13, 2021 @ 10:51
    Alex Skrypnyk
    0

    Hi Madeline

    You have to use real node ID in GetById method, can you check that you use the correct node ID there?

    Thanks

    Alex

  • Søren Kottal 530 posts 3521 karma points MVP 2x c-trib
    Jan 13, 2021 @ 11:24
    Søren Kottal
    1

    Hi Madeline

    What documentation article did you find that in?

    In Umbraco 8 that would be

    @{
    var site = Model.Root();
    var doThis = Umbraco.Content(123);
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies