Try our conversational search powered by Generative AI!

Createing a dynamic menu?

Vote:
 
Hi, I'm new to developing with episerver, therfore my question migt seem simple. I've tried to search the forum for help but haven't found anything that helps me... What I want to do is to create a simple dynamic menu (like the ones you'd normaly use in asp.net 2.0) I'd like to do this from code behind, by accessing sub-pages (children) and maybe even their childpages, but I don't really know how to do this in episerver. (I'm NOT interested in using any episerver tree-control etc, instead I want to do it traditionally, so I know what I'm doing). I suppose one start by creating a reference to the current page, and then accessing properties (like pagename and link) "foreach" subpage. Then it would just be a matter of adding the menuitems to the menu control(which is no problem). But, how do I create a reference and iterate throw the diffrent subpages?! Some code would be nice! Hope someone can help me on this one.
#13192
Sep 06, 2007 10:46
Vote:
 
We mostly use the default code for displaying EPiServer menues. See if u can figure out the Menu.ascx file. I've posted a thread in here asking if they could explain the different episerver:PageTree properties, as this is poorly documented. But it has not been explained yet.
#15520
Sep 06, 2007 15:58
Vote:
 
Ah... didn't see the NOT interested statement.
#15521
Sep 06, 2007 16:06
Vote:
 
You could try something like this: public static PageDataCollection GetNavChildren( PageReference parentPage ) { PageDataCollection navChildren = new PageDataCollection(); foreach( PageData page in Global.EPDataFactory.GetChildren( parentPage )) { if( page.VisibleInMenu ) navChildren.Add( page ); } return navChildren; } And you if you want to start from the site homepage, pass Configuration.StartPage as the input parameter.
#15522
Sep 06, 2007 17:44
Vote:
 
Thanks Jeremy, Really nice of you to help out! I will try that code, and hopefully make it work! Steven, thanks anyway, for taking the time! /Andreas
#15523
Sep 07, 2007 15:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.