Get the link of the parent node

Celero Solutions asked on June 18, 2014 17:37

Hi, I need to display a sitemap at the bottom of the page in columns. I can't use a CSS List Menu web part because I need to display the first two sections of the site side by side in columns. Then the third and fourth column stacked one on top of the other. Then the fifth column beside that and then the last two columns one on a another. Each column will start with the parent for that section followed by the first level children underneath. I had asked what the best way was to do this in another question but can't seem to find that question to add on to it with this new one. Essentially it was suggested to use different zones and repeaters. So zone1 would contain a repeater to display just the parent menu item then a second repeater would contain the children.

To display the parent I set the path to /ParentName/% and the "select top N documents" to 1. I created a transformation with the following:

<li><h4><a href=<%# CurrentDocument.Parent.NodeAliasPath %>> <%# Eval("Parent.DocumentName")%></a></h4></li>

This works great until I check the home page (the zones/repeaters are placed in the master page template). The name of the parent still displays but the link no longer works. It goes to the home page which it shouldn't. If the parent of section 1 is "News" then the top of the column should read "News" with a link to "News". Any suggestions?

   Please, sign in to be able to submit a new answer.