Hi everyone - early days for us with EPiServer 5 so excuse the (what should be) fairly obvious question, but we want to start the Page collection source as being children of the current page, not as children of the start page. So...
<OurMenuList>.PageLink = PageReference.StartPage;<OurMenuList>.DataBind();
works great for the root navigation, but we want our current page (a 1st level sub-navigation) to be the start page - something like (which doesn't work)
<OurMenuList>.PageLink = PageReference.SelfReference;<OurMenuList>.DataBind();
Any pointers much appreciated!
MenuList.PageLink = CurrentPage.PageLink
Or you could set in the aspx: PageLinkProperty="PageLink", then you don't need to databind the pagelist.
Thanks for the reply Erik - and yes that makes total sense!
However what I've actually worked out is that we actually don't really want to do what I was suggesting as when we navigate through the site we want the navigation to stay consistent, not changing to sub-sub pages etc... :-)
So, what we really want to be able to do is to get the OpenTopPage from our primary MenuList and use this as a secondary navigation without showing the primary navigation.
I can achieve this currently by creating the primary navigation as a MenuList and then creating the secondary navigation as a PageTree and hiding the primary MenuList using display=none in the CSS.
However this seems a pretty ugly way to do it so has anyone got any good suggestions as the _right_ way to do this?
I think I can answer my own question here :-)
Looks like creating a MenuList object directly in the code means that you can refer to it, without actually having to display it.
You still need to set the MenuList property. See the public templates code (master page code-behind) for an example or http://www.frederikvig.com/2009/08/episerver-web-controls-menulist-and-pagetree/ (I've updated the code after your comment).
Cool Frederik - many thanks again :-) Alex