Solved

Trouble getting <asp:Menu> to properly render an XML Datasource

Posted on 2004-10-08
3
243 Views
Last Modified: 2010-08-05
I am working with the new ASP.net version 2 beta (which by the way is really nice) and I have created a menu that is using an XML file for its datasouce.  Works great except for one little problem.  The root node name shows up in the menu!  The menu options wind up lokking like this . . .

MenuItems             <<<  This line shouldn't appear  >>>
   SPD News
   My Profile
   FAQs
   Downloads
   Links
   Legal
   Help

Can any of you experts out there tell me how to make my menu start at node-level 1 and not node-level 0?  Oh . . . I don't want to use the SiteMapDataSource for this menu although it is being used elsewhere in the web app.  Also, is it possible to use a SiteMapDataSource that does not point to the web.sitemap file.  I have had no success in getting this to work either.

<?xml version="1.0" encoding="utf-8" ?>
<MenuItems>
  <MenuMapNode Targeturl=""    title="SPD News"      description=""    roles=""/>
  <MenuMapNode Targeturl=""    title="My Profile"      description=""    roles="" />
  <MenuMapNode Targeturl=""     title="FAQs"             description=""    roles="" />
  <MenuMapNode Targeturl=""     title="Downloads"     description=""    roles="" />
  <MenuMapNode Targeturl=""     title="Links"             description=""    roles="" />
  <MenuMapNode Targeturl=""     title="Legal"             description=""    roles="" />
  <MenuMapNode Targeturl=""     title="Help"              description=""    roles="" />
</MenuItems>

Thanks in Advance.
Tony Trotter
0
Comment
Question by:tony_trotter
3 Comments
 

Author Comment

by:tony_trotter
Comment Utility
I gues I'll have to answer this one myself.  the solution that I found was in using XPath to filter what was returned to my control.  The code that I came up with and that works is listed below.

        ' Establish the XML file that will be the datasource for the menu.
dsMenu.DataFile = "~/Data/DefaultMenuNodes.xml"
        ' This next line tells the menu control what data to pull from the XML file based on the users Role.
dsMenu.XPath = "MenuItems/Menu" & intPageMenu & "/MenuMapNode[@roles='Public' or @roles='" & Session("Role").ToString & "']"
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now