Navigation Control suggestion

Posted by Community Admin on 05-Aug-2018 22:06

Navigation Control suggestion

All Replies

Posted by Community Admin on 17-Feb-2011 00:00

When I first started looking at the navigation control, I was happy to see that we could select a set of pages to be used for the navigation. I was quickly disappointed that this option was not available for most of the options for navigation output. I did however find out that if I go to the Advanced mode, I could force the control to use SelectedPages as the SelectionMode property and specify the pages in the CustomSelectedPages property. While this is not the most user friendly way to go about this it worked. One minor drawback is that if someone messes with the "Basic" view, then it will overwrite the settings I manually entered in the Advanced mode.

While this was great to have the ability to set the pages I wanted to use, I found that there was another problem to this in that it only shows those pages. There is no option to have the child pages for the selected pages show. This was a problem for me as I need to have the child pages show. I was using the "Horizontal with Drop Down Menu" option to have the child pages show as drop down items. But I was stunned to find that it only showed the pages I selected. So I duplicated the NavigationControl control and altered the code a bit. I created a property, ShowChildPages, that when set to true would alter the way the SelectedPages option functioned. The original code created a lit of type SiteMapNode and added the selected pages to this. I just created another variable of type SiteMapNodeCollection and added the same selected pages to it. Then I returned the array or collection depending on whether ShowChildPages was set to true or false. Below is the code that was changed for the select statement in the InitializeSiteMapDataSource method:

case PageSelectionModes.SelectedPages:
    List<SiteMapNode> list = new List<SiteMapNode>();
    SiteMapNodeCollection collection = new SiteMapNodeCollection();
    foreach (SelectedPage page in this.CustomSelectedPages)
    
        SiteMapNode node = null;
        if (page.IsExternal)
        
            node = new SiteMapNode(this._currentSiteMapDataSource.Provider, "ext", page.Url, page.Title);
        
        else
        
            node = this._currentSiteMapDataSource.Provider.FindSiteMapNodeFromKey(page.Id);
        
        if (node != null)
        
            list.Add(node);
            collection.Add(node);
        
    
    if (this.ShowChildPages)
        this.CurrentNavigationControl.DataSource = collection;
    else
        this.CurrentNavigationControl.DataSource = list;
    return;


Maybe we can get this added into the NavigationControl some how. We continually have clients asking for a menu that shows only certain pages. While we could set the other pages to non-navigable, we would rather have the ability to have a full sitemap and then only choose which pages we would want to show in a menu.

One other thing that would be nice to be able to choose between the RadSiteMap control and the RadPanelbar control for the vertical option. Since the Panel Bar has more html elements per item, it gives us more flexibility in the styling that we can offer.

Posted by Community Admin on 21-Feb-2011 00:00

+1 for Panelbar

I had to implement it myself, and so I lose the flexibility of the built-in nav control

Posted by Community Admin on 23-Feb-2011 00:00

Hi Steve,

10x for the suggestion we are going to consider them and try to rewrite the navigation control as soon as possible.

Greetings,
Teodor
the Telerik team

This thread is closed