Developer forum

Forum » Development » Troubles identifying a menu in the navigation provider

Troubles identifying a menu in the navigation provider


Reply


English:


I have a custom design which has a master.htm with two navigation menu's:

 

            <div id="navigationwrapper">
                <ul class="dwnavigation" id="topnavigation" settings="startlevel:1;endlevel:1;expandmode:path;id:topnavigation;">
                    <li><a href="#" class="firstitem">navigation item</a></li>
                </ul>
            </div>

            <!--@ContentPlaceholder-->

            <div id="footernavigationwrapper">
                <ul class="dwnavigation" id="footernavigation" settings="startlevel:2;template:to_footernavigation.xslt;parentid:7;id:footernavigation;">
                    <li><a href="#" class="firstitem">navigation item</a></li>
                </ul>
            </div>

 

Now I would like to alter the first navigation menu only using the navigation provider.
But I can't seem to find a way to identify the menu's within the navigation provider!
The action I would like to do on the first menu works perfectly, but unfortunately it does the same in the second menu ...
While debugging almost everything seems to be Nothing or 0 ...

PS: I saw the 'id' setting in the designs sample, what does it do? It isn't mentioned in the documentation ...

Nederlands:

Ik heb een eigen design waar in de master.htm twee menu’s voorkomen:

 

            <div id="navigationwrapper">
                <ul class="dwnavigation" id="topnavigation" settings="startlevel:1;endlevel:1;expandmode:path;id:topnavigation;">
                    <li><a href="#" class="firstitem">navigation item</a></li>
                </ul>
            </div>

            <!--@ContentPlaceholder-->

            <div id="footernavigationwrapper">
                <ul class="dwnavigation" id="footernavigation" settings="startlevel:2;template:to_footernavigation.xslt;parentid:7;id:footernavigation;">
                    <li><a href="#" class="firstitem">navigation item</a></li>
                </ul>
            </div>

 

Nu wil ik middels een navigation provider alleen het eerste menu beinvloeden.

Ik kan echter absoluut niet vinden hoe ik in de navigationprovider dit menu kan identificeren ....

De actie die ik wil ondernemen werkt in m'n navigationprovider, maar wordt op beide menu’s doorgevoerd ...

Als ik debug is bijna alles Nothing of 0 ... 

 

PS: de setting ‘id’ zag ik in een van jullie voorbeeld designs staan, wat doet het? Het staat ook niet in de documentatie namelijk ....

 


Replies

 
Nicolai Høeg Pedersen
Reply
Hi

You should be able to do the check in your navigation provider like this:

if(this.XmlNavigation().NavigationName()=="topnavigation"){
}

NavigationName name property of xmlnavigation is the ID of the navigation.
 
Reply
nope ... doesnt work!

Both roundtrips in the extender give 'topnavigation' as NavigationName and again both menu's are altered ...

Feels like a bug ...

When I look at my homepage.parsed.htm file it gives me:
            <div id="navigationwrapper">
                <!--@DwNavigation(topnavigation)-->
            </div>                .... more content here ...           
            <div id="footernavigationwrapper">
                <!--@DwNavigation(footernavigation)-->
            </div

My Extender looks like:

        Public Overrides Sub ProcessTree(ByVal rootNode As Dynamicweb.Frontend.NavigationProviders.RootNavigationItemByVal navigationType As Dynamicweb.Frontend.XMLNavigation.NavigationType)
 
            If (Me.XmlNavigation.NavigationName = "topnavigation"Then        
' wanting to do my stuff here only to alter topnavigation        ' when debugging Me.XmlNavigation.NavigationName gives me        ' topnavigation as value at both navigation encounters... WHY !!!!                        
            End If
 
        End Sub




 
Nicolai Høeg Pedersen
Reply
That is a bug - just checked it out and made a fix... will be out with - next hotfix.

Bug number: TFS 5493

 

You must be logged in to post in the forum