Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.
You could have a look at the source code for ETF at http://etf.codeplex.com, more specifically the PageTree control: http://etf.codeplex.com/SourceControl/latest
It has some additional templates you can use to specify custom markup for the first and second items.
Can't get the link to work here, but browse to /TemplateFoundation/Release 1.2/TemplateFoundation/WebControls/PageTree.cs
Or use CSS3 with polyfill scripts for less-than-modern browsers. :)
Thanks Ted.
How do I use that source code? I'm quite new to EPiServer.
Will that source code detect the first and last items? What would the templates be called?
Many thanks,
Chris
I just want to check that you are building a tree menu and not just a one level menu?
Yea, I'm using a PageTree control to make a complete drop-down menu that will use Javascript to hide/show the drop-downs.
In the end I created a PageDataCollection object onLoad, used the PageTree "GetChildren" function to get a list of menu items and used a "Count" on that to detect whether we were on the last object.
I made a function call inside each of the PageTree templates to do the check.
Hi guys,
Is it possible to target the first and last elements in a PageTree control? I am trying to render a site menu as such...
<ul>
<li class="first">Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li class="last">Item 4</li>
</ul>
...where I require a "first" CSS class and a "last" CSS class on the first and last items respectively. How would I detect the first and last elements in the control, and update the HTML accordingly? Would I need to attach an "ItemDataBound" or is there another easy way using a function in the code-behind?
Thanks in advance,
Chris