Solved

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

Posted on 2004-10-08
3
247 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

18 Experts available now in Live!

Get 1:1 Help Now