Portal Engine
Version 2.x > Portal Engine > get documentid with NodeParentID View modes: 
User avatar
Member
Member
kogany - 12/19/2006 11:29:49 PM
   
get documentid with NodeParentID
Hi
How i can get DocumentID of Parent element
i see only NodeParentID

thanks Alex

User avatar
Guest
admin - 12/20/2006 10:21:09 AM
   
Re: get documentid with NodeParentID
Hi Alex,

you can use the following command:

CMS.CMSHelper.TreeHelper.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentDocument.NodeParentID).DocumentID

Best Regards,

User avatar
Member
Member
kogany - 12/20/2006 8:59:18 PM
   
Re: get documentid with NodeParentID
Ok thank you
but i receive error "Timeout expired" becouse table is locked
i can canceled Transaction mode in CMS ?

thanks alex

User avatar
Guest
admin - 12/23/2006 11:21:24 AM
   
Re: get documentid with NodeParentID
Do you call this method in the CustomTreeNodeHandler? If so, you can get the parent of the current document like this:

treeNodeObj.NodeParentID

Best Regards,

User avatar
Member
Member
kogany - 12/24/2006 11:03:28 AM
   
Re: get documentid with NodeParentID
thanks but i need get DocumentID not NodeParentID

User avatar
Guest
admin - 12/26/2006 2:04:30 PM
   
Re: get documentid with NodeParentID
Hello,

you may need to use a code like this then:

TreeProvider treeP = (TreeProvider) tree;
TreeNode currNode = (TreeNode)treeNodeObj;
int x = treeP.SelectSingleNode(currNode.NodeParentID).DocumentID;

Please note that you will need to add a reference to the CMS.TreeEngine library and put

using CMS.TreeEngine;

at the beginning of the CustomTreeNodeHandler.cs code.

Best Regards,