Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-08
3
Medium Priority
?
256 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

704 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