Copied to clipboard

Flag this post as spam?

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


  • Nguyen Minh The 12 posts 99 karma points
    Mar 25, 2019 @ 09:03
    Nguyen Minh The
    1

    Cant use TypedContent in Umbraco 8

    Hello there,

    I just install and try Umbraco 8. In Umbraco 7 I often use something like:

    var posts = Umbraco.TypedContent(Node's Id number);

    To work with that Node Content, but now I can't use it. I got error "TypedContent doesn't exsist in Umbraco namespace", so how to use get a Node Content in new Umbraco?

    Thanks for your reading and sorry for my bad English.

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Mar 25, 2019 @ 09:11
    Marc Goodson
    3

    Hi Nguyen

    It's been simplified to be:

    var posts = Umbraco.Content(Node's Id number);

    (now that 'dynamics' has been removed, there is just the IPublishedContent way to pull things back, so no need to have the word Typed in the method name

    regards

    Marc

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Mar 25, 2019 @ 09:11
    Søren Gregersen
    4

    The method has moved to

    Umbraco.ContentQuery.Content()
    
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Mar 25, 2019 @ 09:12
    Sebastiaan Janssen
    1

    Try var posts = Umbraco.Content(1234); instead ;)

    Edit: duh.. I was much to slow in answering that one 😂

  • Nguyen Minh The 12 posts 99 karma points
    Mar 25, 2019 @ 09:17
    Nguyen Minh The
    0

    Hello everyone,

    I really impressed with the Umbraco community. Thanks for all your supports.

    I still got the problem enter image description here

    This is my current code

    enter image description here

    I think I may miss something when install the project

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Mar 25, 2019 @ 09:20
    Søren Gregersen
    102

    Your view is not inheriting from any of the umbraco pages, so it tries to use the umbraco namespace, and not the umbracohelper.

    Try addding something like this

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.HomePage>
    

    at the top of the view

Please Sign in or register to post replies

Write your reply to:

Draft