Issue with dynamic horizontal dropdown menu - General Discussions - General Discussions - Progress Community
 General Discussions

Issue with dynamic horizontal dropdown menu

  • Issue with dynamic horizontal dropdown menu
  • Hi All
       Am new with sitefinity.Am using sitefinity4.4. In my project i want to use  horizontal dropdown menu with custom selection of pages.Now am using Horizontal With DropDown Menu  Navigation widjet.But here there is no options for custom selection of pages.
    Any one plz give me a solution for show horizontal dropdown menus with custom selection of pages.

  • Dear Pretty

    I might not understand your term 'custom selection of pages'. The Navigation Widget will include all pages that have the checkbox 'Show in Navigation' checked under the 'Titles & Properties' section of the page.

    You can however make for example a GroupPage and have that page as an starting point for the navigatin widget.

    If you are looking for a way to tell within the navigation widget which pages to include or not - then I am sorry that is not possible at the moment (and wont probably for the next 12 month)

  • Hi Markus
        Thank you for your response. But my issue is not yet solved.In my project there is more than 200 pages.In this  20 pages set '
    Show in Navigation' property as checked.Am using both vertical menu and horizontal menu in my project.So i want to show all these 20 pages in vertical navigation and only selected 10 pages with sub menu in horizontal  navigation.How is this possible.
       Hop now you got my actual waiting for your response

  • Dear Pretty

    Sorry I don't think what you want an be achieved out of the box and would need some custom programming.
  • Dear Markus
      Can you plz give a sample for creating custom navigation control
  • Dear Pretty

    I guess in order for anyone to help you you would need to specify your needs a bit more. Anyone helping would need to know how how and where to pick the pages you want to show.
    Would it need to be dynamic or could it be hardcoded.
    How would the control know which pages to show. So you would need to state your sites set up and what would happen when with wich pages.

  • Pretty,
        I believe what you are wanting is to be able to use the horizontal menu with drop downs and be able to select the pages the menu will use. While this can be done out of the box, the drop downs will not happen as the selected pages option will only load in those pages in which you select. We had to tweak the NavigationControl to accommodate this functionality.

    Our NavigationControl is derived from the base Sitefinity NavigationControl. In the method that loads the data source, we altered the case in which the SelectedPages option is selected. When looking at the code that is shipped with Sitefinity, the data source is set to a List<SiteMapeNode> of the pages that you select. This list does not include the child pages. We added a SiteMapNodeCollection to the method and populate it with the same selected pages. The difference here is that the SiteMapNodeCollection will include the child pages. We then added a property, ShowChildPages, that will determine whether the list or the collection will be set for the data source. I have asked Sitefinity to include this functionality out of the box. I have found that this is needed more and more as we develop our new sites.

    One thing to note when setting the properties of the control. I normally go in and leave the menu type as horizontal. I then set the pages to custom selection and choose my pages. I then go back and change my menu type to horizontal with drop down menu. Then I go to the advanced mode and scroll down to "SelectionMode" and set it to SelectedPages. This will give you the RadMenu, horizontal with drop down menus, and the selected pages as your datasource. You also need to set the ShowChildPages property to true in order for the child pages to show in the menu. Otherwise you will just have a RadMenu that shows only the selected pages and not their child pages.

    To install this custom control, you just need to download the class from here, and then adjust your ToolboxesConfig.config file with the following:
    <toolboxesConfig xmlns:config="urn:telerik:sitefinity:configuration"
            <toolbox name="PageControls">
                    <add name="NavigationControlsSection">
                            <add type="SitefinityWebApp.Widgets.Navigation.NavigationalControl, SitefinityWebApp"
                                 name="Navigation" />

    This will tell the site to use the custom NavigationControl rather than the built in one. This is not the complete toolbox config file. Just the needed tool. If it is not there, just add in what you need. Otherwise you could just replace the add node with the value from above.

    I hope this helps you out. We have been using this for a while now. This should work on 4.4 and older. The older versions might need some adjustment to the file as Sitefinity has made changes to classes.
  • Hi Richard,

    Thanks for the class! With a little tweaking this worked for me in Sitefinity 5. 

    They must have changed the path to the navigation ascx control you reference in your code so I used Telerik JustDecompile to find it and its at Telerik.Sitefinity.Resources.Templates.PublicControls.NavigationControl.ascx. For some reason though it still wasn't resolving so I just saved the control and put it in the folder with your class, set it's properties to compile as an embedded resources and changed the reference in the class and followed your instructions to add it to the toolbox. Works great, Thanks!

  • Another way to deal with this is to specify a template in the 'Design Settings' of the standard navigation control.

    'Template' bascially refers to 'User-Control' and you get to override the behaviour of the standard control, implementing whatever code you want, depending on your choices on the base control and the RadMenu events you provide in your user-control.

    I used this approach to implement a menu that was a combination of some custom Mega-Dropdowns and standard multi-level dropdowns, and change details such as the tool-tip behaviour etc.
  • MB,
        You are correct if all you want to do is just override the template. I am sure in the template you could add additional pages to the menu, but my post was talking about the limitation with using the SelectedPages option. The code for the NavigationControl will only send back the pages in which you select. It doesn't allow for returning the selected pages and the child pages of those selected pages.

    My solution was to allow for using the SelectedPages option and getting the child pages. I am sure within the external template you could get the pages and then add the child pages to the menu using the API.
  • @Richard

    Yep, no argument - Sitefinity + RadMenu provides you multiple ways to skin the same cat.

    In my case, I used the standard control to set the basic properties to horizontal mode and limited the selection to the 1st level items.

    In my 'template' I managed the ItemDataBound event, where I added a custom mega-dropdown where appropriate, or built the standard drop-down set where it wasn't. The second part was done by running down the SiteMap from the ItemDataBound item, and adding its child menu items. 

    However, I could also have added using a separate data source, or chosen the custom navigation option if I wanted total selection control of the menu, and built whatever I wanted using the template control.
  • Richard,

    I tried to download the zip file you link to and get a server error.  Can you provide the link for me to download that control?

  • Sorry for the delay. I have re-uploaded the archive with the cs file that we use in our 5.4 sites.