Copied to clipboard

Flag this post as spam?

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


  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jul 22, 2011 @ 17:29
    Damiaan
    1

    DynamicNode is empty

    Hi 

    I have a few razor lines.  I expect to two lines to return the same value.  But is doesn't.  

    @(new umbraco.cms.businesslogic.web.Document(1151).Id) // result: 1151
    @(new DynamicNode(1151).Id) // Result: 0

    Can someone tell me why?

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 23, 2011 @ 11:33
    Dirk De Grave
    0

    Damiaan,

    Both values should be the same if document with id = 1151 is published. Document api works with both published and unpublished content, whereas DynamicNode is an implementation of INode which obviously only works with published content.

    @(new umbraco.presentation.nodeFactory.Node(1151).Id)// result: 1151
    @(newDynamicNode(1151).Id)// Result: 1151

    Above snippet should always return the same values for both statements

    Cheers,

    /Dirk

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jul 25, 2011 @ 09:06
    Damiaan
    0

    Hi Dirk,

    The node was published and created by another team member.  

    Apparently the node didn't exist in the umbraco.config file. A republish site solved the issue.

    So i guess that the dynamicNode looks into the umbraco.config while the busineslogic.web.document looks into the database.

    Thanks a lot

Please Sign in or register to post replies

Write your reply to:

Draft