Solved

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

Posted on 2004-10-08
3
252 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
ID: 12425737
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
ID: 12752435
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON error 4 70
Auto Submit on dropdown box 3 79
Sudden decrease in performance when updating mysql using classic asp 6 27
Call a function within the ASP code 4 19
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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