473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Binding ASP.NET Menu to XML

I have created a XmlDocument that contains the exact layout that
siteMap uses, and then I bind my Menu object to it:

Dim xml As XmlDocument
xml = DirectCast(Session("MenuData"), XmlDocument)

Dim xmlDS As New XmlDataSource()
xmlDS.Data = xml.OuterXml

MainMenu.DataSource = xmlDS
Dim mb As New MenuItemBinding()
mb.DataMember = "SiteMapNode"
mb.TextField = "Title"
mb.NavigateUrlField = "url"

MainMenu.DataBindings.Add(mb)
MainMenu.DataBind()

The problem is when it displays it always shows the root element
("siteMap"). If you use a static site map you have an option to turn
this off; am I missing the ability to do that since I'm using XML?

Thanks,
DvS

Mar 19 '07 #1
1 6001
On Mar 19, 5:04 pm, dvoms...@ddrtech.com wrote:
I have created a XmlDocument that contains the exact layout that
siteMap uses, and then I bind my Menu object to it:

Dim xml As XmlDocument
xml = DirectCast(Session("MenuData"), XmlDocument)

Dim xmlDS As New XmlDataSource()
xmlDS.Data = xml.OuterXml

MainMenu.DataSource = xmlDS
Dim mb As New MenuItemBinding()
mb.DataMember = "SiteMapNode"
mb.TextField = "Title"
mb.NavigateUrlField = "url"

MainMenu.DataBindings.Add(mb)
MainMenu.DataBind()

The problem is when it displays it always shows the root element
("siteMap"). If you use a static site map you have an option to turn
this off; am I missing the ability to do that since I'm using XML?

Thanks,
DvS
If anyone else is interested, the solution is to add the following
line:

xmlDS.XPath = "/*/*"

Mar 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
1
by: PCC | last post by:
I am using the Infragistics UltraWebNavigator menu control and am having trouble building my menu hierarchy either by data binding or coding it manually. I have included a sample of my Menu table...
2
by: Rodney Lane | last post by:
Hi, I am using an oledb data adapter to connect to an MSAccess 2003 database. I use bindings on my windows forms to bind fields to the controls and for text boxes and grids it has been fine. ...
0
by: paulsmith5 | last post by:
Hi, I'm trying to bind a datalist to an XML file to create a menu bar of sorts. The XML file contains a list of menu items grouped into two main topic areas see below: <TOPICLIST...
3
by: Ray Booysen | last post by:
Hi all I have a treeview bound to a sitemap. Once the user is logged in, I'm wanting the menu to expand to include additional items from a database while retaining the items in the sitemap. Is...
0
by: Tumurbaatar S. | last post by:
It's my first project using the Crystal report. I created a report with the report designer and linked it to a web form as: 1. put CrystalReportViewer in my page (its ID: Viewer). 2. put...
1
by: Adotek | last post by:
Hi All, I've just converted a solution from .Net v1.1 to v2.0, by allowing Visual Studio 2005 to do the conversion. Since doing so, I am getting a compilation error as follows: "Option...
1
by: AMDRIT | last post by:
Hello Everyone, We have a production WinForms Application that uses a WebBrowser to display readonly data. In the html document we have SPAN elements that facilitate menu selections. We also...
0
by: Andy | last post by:
Hi, I have the following Xaml.. I'm not sure why I can't get the context menu item's to bind to a property of the window. Any ideas? Thanks Andy <Window...
5
by: z1freeride | last post by:
So I implemented a javascript-based menu. And I wanted to keep the state of that menu when a person comes back to my page. So to do that, I create a cookie using javascript and I put the clicked link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.