Copied to clipboard

Flag this post as spam?

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


  • Chris Houston 533 posts 977 karma points MVP admin c-trib
    Jul 31, 2009 @ 15:29
    Chris Houston
    0

    How to add items only to specific nodes in a tree based on the DocType?

    Hi all,

    I am adding a menu item to the content tree using BaseContentTree_BeforeNodeRender, what I wanted to be able to do was add the menu item only to certain nodes based on their NodeType, but, it seems that although the name of the node changes (node.Text) to reflex the current menu item, the node type (node.NodeType) always returns "content" which to me seems pretty ilogical.. is this a bug and does anyone have an elegant solution for this?

    Cheers,

    Chris

  • Richard Soeteman 3875 posts 12037 karma points MVP
    Jul 31, 2009 @ 16:01
    Richard Soeteman
    103

    Hi Chris,

    The nodetype is the type of the node, not the document type so this behaviour is correct.

    When you want to use the doctype you need to get that form the document class.I've made an example using the following event handler. If you run this code the variable doctype will be different. I think this will introduce a performance penalty, not sure.

     

    public void BaseContentTree_BeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e)

    {

     

    Document doc = new Document(int.Parse(node.NodeID));

     

    string docType = doc.ContentType.Text;

     

     

    }

    Hope it helps you,

    Richard

  • Chris Houston 533 posts 977 karma points MVP admin c-trib
    Jul 31, 2009 @ 16:09
    Chris Houston
    0

    Thanks Richard, Just what I needed.

    Cheers,

    Chris

  • 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