MenuList - show root element

Vote:
 
Hi, Here is my problem: I'm creating top menu, to do this im using episerver control MenuList. What I want achive is including to my tabs also a tab to "rootPage" so the page which I sepecifie in PageLink property for my MenuList. For know I can only see first level children of rootPage. Here is a code from ascx:
Here is how I tried to solve that problem: 1. First idea was to get datasource of MenuList, cast it on PageDataCollection, add StartPage to it, assign this collection to datasource. But datasource of MenuList seems to be null. PageDataCollection pdc = new PageDataCollection(); pdc = MenuListControl.DataSource as PageDataCollection; pdc.Add(Global.EPDataFactory.GetPage(Configuration.StartPage)); 2. Create new PageDataCollection, add some pages to it, assign this collection to datasourc, databind. PageDataCollection pdc = new PageDataCollection(); pdc.Add(Global.EPDataFactory.GetPage(new PageReference(2503))); pdc.Add(Global.EPDataFactory.GetPage(new PageReference(227))); pdc.Add(Global.EPDataFactory.GetPage(new PageReference(3))); MenuListControl.DataSource = pdc; MenuListControl.DataBind(); 3. Setting PageLink to RootPage and NumbersOfLevels on -2 or 2 this only give me a startpage even if I set NumbersOfLevels 4. I thougt of using PageList but in this control I cant use SelectedTemplate functionality which is very important for me. Please give me any sugestion how I can solve my problem. Best Regards, Piotr
#12822
Mar 25, 2008 18:35
Vote:
 
I'm not sure if I've understand your question correctly but if you would like to add the startpage to the list of items in your menulist the easiest way of solving this would be the following: 1) create a new page under the startpage and name even this page "Startpage", the page type shouldn't be of interest. 2) Set the shortcut of that page to the real Start page. 3) Now you are up and running with the little problem that your startpage never will be "selected". 4) if you like to have a "selected" start page you can try to switch the "startpages", one pointing to the other instead (not forget to set the EPnStartPage in web.config to your new page. Hope that will help /René
#14939
Mar 25, 2008 18:46
Vote:
 
Hi, Thank you Rene for your answer. You've correctly understood my problem. Points 1 - 3 are clear for me and it works. As you mentioned the last problem after completing this 1-3 steps is that the new tab is never 'selected'. Could you please clarify more point 4? Piotr
#14940
Mar 25, 2008 18:46
Vote:
 
Lets say your structure looks like that: 1 root 1.1 Start page 1.1.1 Start page 1.1.2 Page 2 1.1.3 Page 3 ... 1) Now you would point your web.config (EPnStartPage) to page 1.1.1 instead of page 1.1. 2) Then add a shortcut from 1.1 to 1.1.1 (shouldn't really be necessary but what the ...) 3) Addition to my previous post: Change the PageListProperty in your MenuList to point to page 1.1 instead of Configuration.StartPage Hope that clarifies /René
#14941
Mar 25, 2008 18:46
Vote:
 
Thank you a lot Rene, it is working.
#14942
Mar 25, 2008 18:46
* 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.