ASPX templates
Version 4.x > ASPX templates > Why would a TreeNode have a NodeParentID referencing a document that doesn't exist? View modes: 
User avatar
Certified Developer 9
Certified Developer 9
jkh80 - 6/3/2009 12:50:57 PM
   
Why would a TreeNode have a NodeParentID referencing a document that doesn't exist?
I have run into a very strange issue with a site that is using a custom navigation control I built.

The client has items at the second level of the content structure that are shared among many areas of the site, so they are using linked documents to facilitate this need. Here is an example of what they have set up:

Parent
Page 1
Page 2
Another Parent
Page 3
Page 1 ->

Under "Another Parent", the "Page 1" document is linked to the "Page 1" document under the "Parent" document. All of these documents are of the type CMS.MenuItem.

Again, this works fine - if I look at the NodeParentID of the "Page 1" TreeNode object that is the child of "Another Parent", it returns the DocumentID of the "Parent" document.

Here's where it gets weird - if I try to create another link to the "Page 1" document under a third parent item, the NodeParentID property of that TreeNode object returns a DocumentID that does not exist in the database, or anywhere in my content structure.

Is this some a bug of some sort or am I missing something? Any help would be appreciated.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 6/4/2009 8:51:11 AM
   
RE:Why would a TreeNode have a NodeParentID referencing a document that doesn't exist?
Hi,

I have tried to reproduce your issue but without success. I have created linked documents under several parent nodes - the ID was always correct.I have also tried to create linked documents from already linked documents and this is also working fine.

Could you please describe me this issue with more details? Maybe step by step description will be helpful. Also, more information about the version of CMS you are using - the build number. Have you applied any of the hotfixes we have released?

Thank you.

Best Regards,
Juraj Ondrus

User avatar
Certified Developer 9
Certified Developer 9
jkh80 - 6/5/2009 12:13:53 PM
   
RE:Why would a TreeNode have a NodeParentID referencing a document that doesn't exist?
Hi Juraj,

I found the problem I was having. I was calling CMS.CMSHelper.TreeHelper.SelectSingleDocument() where I meant to call CMS.CMSHelper.TreeHelper.SelectSingleNode() in my class, mixing up the document ID and the node ID.

However, I am now having another problem. I am using the CMS.TreeEngine.TreeProvider.SelectNodes() method to get the children of a node, but for a few parent nodes that have children, no data is being returned. All the nodes in question are of type CMS.MenuItem.

I am using Kentico version 4.0, build 4.0.3436, and I have applied hotfix 4.0.5 to my site.

Here is the call I am making, is there any reason that the child nodes of "Parent" would not be returned here?

CMS.TreeEngine.TreeProvider treeProvider = new CMS.TreeEngine.TreeProvider();
treeProvider.MergeResults = true;
DataSet ds = treeProvider.SelectNodes(
"MySite",
string.Format("/Parent/%"),
"en-US",
false,
"CMS.MenuItem",
null,
"NodeOrder",
1);

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 6/20/2009 3:26:36 AM
   
RE:Why would a TreeNode have a NodeParentID referencing a document that doesn't exist?
Hello,

Just for other visitors: this issue has been solved over e-mail. It was caused by there was space used in alias path. If you enter document name with space, the space is automatically converted to hyphen in document alias. You can eventually check alias path for document in 'CMSDesk -> Content -> select document in tree -> Edit -> Properties -> General' section.

Best Regards,

Martin Dobsicek