Hi,
If you are using something like this:
CMS.TreeEngine.TreeProvider tp = new TreeProvider();
CMS.TreeEngine.TreeNode currentNode = tp.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, CMS.CMSHelper.CMSContext.CurrentAliasPath, CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentCulture);
while(currentNode.NodeParentID != null)
{
if(currentNode.ClassName == "Custom.config")
break;
else
currentNode = tp.SelectSingleNode(currentNode.NodeParentID);
}
It is also correct way. You can also get the parent document using this, which is very similar:
CMS.TreeEngine.TreeProvider tp = new TreeProvider();
CMS.TreeEngine.TreeNode currentNode = tp.SelectSingleNode(CMS.CMSHelper.CMSContext.CurrentSiteName, CMS.CMSHelper.CMSContext.CurrentAliasPath, CMS.CMSHelper.CMSContext.CurrentPageInfo.DocumentCulture);
CMS.TreeEngine.TreeNode parentNode = tp.SelectSingleNode(currentNode.NodeParentID);
string documentName = parentNode.DocumentName;
Best Regards,
Juraj Ondrus