Solved

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

Posted on 2004-10-08
3
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JS does not refresh 6 44
ASP get fieds value 2 40
window close link 7 66
Add Rows on a Table 8 55
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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