I have a custom section News, where it has some trees..
When I go to the News section from the Content section it first time shows it fine, but when I go to Content section and then back to News section the tree names are duplicated.
For each time I switch between the Content and News section it seems to add the tree names once again and give the trees the same names.
I assume you create an XmlTreeNode in the render method of you content tree? Make sure you assign an Unique value to NodeId, not only for the tree but for the whole site if you don't do that. it will generate the behaviour you are having. Below a small example
XmlTreeNode node = XmlTreeNode.Create(this); node.NodeID = menuItem.ID.ToString(); //This must be unique
Duplicate tree name
I have a custom section News, where it has some trees..
When I go to the News section from the Content section it first time shows it fine, but when I go to Content section and then back to News section the tree names are duplicated.
For each time I switch between the Content and News section it seems to add the tree names once again and give the trees the same names.
How can it be?
Bjarne
Hi,
I assume you create an XmlTreeNode in the render method of you content tree? Make sure you assign an Unique value to NodeId, not only for the tree but for the whole site if you don't do that. it will generate the behaviour you are having. Below a small example
XmlTreeNode node = XmlTreeNode.Create(this);
node.NodeID = menuItem.ID.ToString(); //This must be unique
Thanks,
Richard
Hi Richard
I have this in my code:
So it need the NodeID too? where do you get the unique value to the ID, in your example menuItem?
I have worked from this example: http://www.geckonewmedia.com/blog/2009/8/3/how-to-create-a-custom-section-in-umbraco-4
I don't remember if it was a problem when I created a custom section in Umbraco 4.5.x but now I use Umbraco 4.7.
I looked at this solution from Morten http://our.umbraco.org/forum/developers/extending-umbraco/11345-Custom-tree-and-section-Text-duplicate-issue, which is much the same as you suggest Richard.
I came to this solution:
where I have added the NodeID and set the Menu attribute to null.
Now it don't duplicate the text.
Bjarne
is working on a reply...