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

0
dvomsaal (2)
3/19/2007 9:04:45 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
696 Views

Similar Articles

[PageSpeed] 32

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 = "/*/*"

0
dvomsaal (2)
3/20/2007 8:23:34 PM
Reply:

Similar Artilces:

ASP to Excel
I have an ASP page that allows user to export data to Excel. Sometimes the data in a cell may be something like 61E287 which Excel treats as a scientific entry and changes the format to 6.1E+287. I believe I need to format the cell as a text field before the value is entered. Any ideas on how to do this? Thank you, Sarah ...

Menu od child windows
Hi! Is it possible to put menu od child window when using MDI? "Jolpez" <jolpez@no.com> wrote in message news:hq2qcn$7ld$1@gregory.bnet.hr... > Is it possible to put menu od child window when using MDI? Yes, you can use the MdiWindowListItem property of the MenuStrip to set the ToolStripMenuItem that should display the list of child forms. "Jolpez" <jolpez@no.com> wrote in message news:hq2qcn$7ld$1@gregory.bnet.hr... > Is it possible to put menu od child window when using MDI? Please tell us which word you meant to type inste...

�M�~����H�s�A�� �P�B�䴩 PHP+MySQL, Access+ASP, ASP.NET, CGI, SSI �q�l�f�r�L�o, �U���q�l�L�o ��WebMail ......................
�Ҧ��b����C�e�ӽЪ��䥦���q�ಾ�Ȥ�Y�h�e�z�T�Ӥ�A�� �䴩 PHP+MySQL, Access+ASP, ASP.NET, CGI, SSI �q�l�f�r�L�o, �U���q�l�L�o �� WebMail ��...... ����C�e�ӽ�W1000�Y�e�����w���ʪ����{�� osc. http://shop2.uhostnet.com �C��u�� $20 �_ ���� http://www.uhostnet.com �s�Ȥ�}�q�˪O http://dummy.uhostnet.com �s�«Ȥᴣ�ѤC�ѧK�O�د����C �i�ϥΥ����q�K�O���Ѫ��ư�W�C �A�ȭp���R�Q�e�G�A�Z�wú�Q�Ӥ�A�Ȥ�O�A�h�e��Ӥ�C �{�Y�Ө䥦���q��Χڭ̡A�Y�h�e�z�T�Ӥ�A�ȡC(����W�ಾ) �H�W�p�����ĥΤ���WIN2003���x�A�Ȥ��i��Υ����q��Linux���x�A�ȭp���C ���e��ε{�� ASP �d��ï,��ѫ�,ASP �H�ƾ�,PHP �H�ƾ�,ASP ��W�q�l���,ASP �ɮ׺޲z�{��,��W�ө�,���t�ΤΦU�ڽ׾...

Xml Serialization Control
Greetings, I used the XSD tool to generate a C# class of fields from a very complex Schema that was created in BizTalk 2004. When it encounters one of the properties who's type is a class (I changed to a List<> from an array [] beacuse it is easier to populate from multiple unknown sources when doing internal mapping but it makes no difference regarding my question which way I choose to do it -- the problem is the same): /// <remarks/> [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] [System.Xml.Seriali...

XML Source Menu Item disabled?? File version??
My XML Source Menu Item is disabled (aka greyed-out). Why? I have a workbook with multi-worksheets and I want to enable a conversion to XML, I'm trying to follow the documentation here, but it's poorly organized and more poorly written (IMHO).. I can't find anything which tells me why the menu item would be disabled. The version is Office 2003 Pro and (clearly) the capability is there, I can see the "XML Source" item. I did a quick test and if I make a brand new file, I have the XML Source option so that means means this is a file version issue?. I know this wo...

Microsoft .NET Framework 4 Client Profile installs over and over a
Hello! My PC keeps downloading Update KB982670 (Microsoft .NET Framework 4 Client Profile for Windows Vista x64-based System) even after it has already been successfully installed several times. Is there any problem with the installation of this update? I am thankful for any advice. Best regards, Rui Nunes Urizen wrote: > Hello! > > My PC keeps downloading Update KB982670 (Microsoft .NET Framework 4 Client > Profile for Windows Vista x64-based System) even after it has already been > successfully installed several times. > > Is there any prob...

OutlookExpress filters files with certain extensions (like .ASP, .PDF, etc.),
I have OutlookExpress 6. When I receive files with certain extensions (like ..ASP, .PDF, etc.), it says "OE removed access to the following unsafe attachments in your mail: filename.PDF". The file does not contain virus, but it still filters any files with this extension and other extensions like ..ASP. This did not used to happen before, just start happening recently. How can I fix this problem ? Thank you. Tools->Options->Security. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) vi...

Updating graphs based on choice in drop-down menu: #3
Hello everyone, I am working on a little side-project for school. I would like to include an Excel spreadsheet that updates automatically depending on the selection made in a dropdown menu. The scenario is this: I am a reseller of various goods. My products come from multiple vendors which are located in a variety of countries. I purchase these goods in bulk, markup the price by various percentages, and then resell the goods to multiple customers. I am trying to utilize the power of Excel in order to track the successes and failures of various transactions. A sample of the data I am using,...

programmatically change the binding order
All, How can I programmatically change the binding order of the network protocol in Win XP using VC++. Thanks in advance. ...

Xml Attribute..id problem??
Hi, I have an xml file as below <root> <table id =1> <user>abc</user> <age>25</age> </table> <table id = 2> <user>xyz</user> <age>45</age> </table> ..... ..... </root> What I want is this id attribute to increment automatically. So I declared it of type "ID" ..but how do i access the value of this attribute. When i add a record it gets added to the xml file but the id attribute does not show..So how do i refer to this attribute. smita wrote: > What I want is this id attribute to incre...

Binding a Textbox to a property
I have a property "TotalCost" of type int and a TextBox "tbTotalCost" in the main form "Form1" and was wondering how to bind one to the other tbTotalCost.DataBinding.Add("Text",this.TotalWinnings, erm); First peram. should be Property Name but in the examples Ive seen it usually has "Text". Guessing its because it is the Text property of the TextBox? Second peram. should be object DataSource. That the propery? Third should be DataMember. Erm... Flailing around a bit as you can see. mick "mick" <coughco...

CMenu class and menu object
Hi, I'm creating a submenu for a popup menu in a different function (see the code below), and the menu object (CMenu) for that submenu is a local variable, so it is getting created on the stack that is not valid after function returns. Is it safe to use the popup menu that contains submenu showe CMenu object is destroyed ? This doesn't crash, visually it works find, but seems like it is not safe to leave it like this. There is a suggestion to Detach before returning from AddSubMenu() function. Is that enough ? Will the whole popup menu be successfully destroyed after we re...

Fail to install .Net 1.1 SP1
Dear All, My laptop is a Toshiba Tecra w/ Pentium M at GHz with 1GB RAM Hard drive 60GB - Free 30GB I have Windows XP Professional SP2 Antivirus/antispyware, etc: Norton 360 Suite I run automatic update daily. Today I got the following update: Microsoft .NET Framework 1.1 Service Pack 1. I have run it 20 times at least. The session initializes normally but it always fails to complete. I only get this mssg: "Some updates could not be installed" + "The following updates were not installed: Microsoft .NET Framework 1.1 Service Pack 1." The yellow shield in my tray k...

Stupid (I hope) XML questions
Ok, I have a project that is destined for continual growth and development over the next few years (benign scope creep). The object model is relatively generic at the moment, but will be extended considerably over time, mostly using inheritance. Each document will have a single element at the root and it will contain a collection of objects that are based off of a finite number of base classes. However, these objects may have numerous child classes and I can not guarantee that the child classes won't be containers themselves. References will be allowed between objects of different base typ...

Requirement to have an ASP.NET website up and running
Hi, I am new to ASP.NET design and programming. I am an MS Access database developer for my organization (for my LAN). Recently, my boss require other staff to start acessing to the database from the internet which is not possible for Access to handle this. I start researching and know that only ASP.NET could solve the problem. The first thing I want to know is: 1 - How to enable user to access the project database from the internet (What I should have/update my LAN) for that porpuse) 2 - How can I restrict the security (Can I use AD to limit user accessing to the project da...

How do I remove a gutter for a binding edge in Publisher 2007?
I started a document thinking I'd bind it on the left, but as it evolved, I will be binding it on top. I cannot find the place that lets me change this! The print preview, page setup etc. don't give me any options. This is a printer option. Look at your printer setup. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Mayaluga" <Mayaluga@discussions.microsoft.com> wrote in message news:7E8FE3F1-F81A-44D1-BE16-975F3CE7AEF4@microsoft.com... >I started a document thinking I'd bind it on the left, but as ...

Changing the Main Menu at Runtime
This is a multi-part message in MIME format. ------=_NextPart_000_00B3_01C4297D.E3789D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I added a menu to my dialog based MFC program using the menu = editor/wizard. How can I change the properties of some menu options at = runtime? For example, I need to gray and ungray menu options. Is there a = way to set up a control variable and call methods for it like in Visual = Basic? Also, it would be nice if I could turn visibility on and off for = menu options like is possible in VB. --=20 ~void...

Word 2003 duplicates two headings in the menu bar
Wnat to know how to delete one of these headings so as to enable keyboard access rather than just the mouse Are you saying that menu items are being duplicated? That could be caused by a poorly designed add-in adding an item without checking if it's already present. -- Stefan Blom Microsoft Word MVP (Message posted via NNTP) "shp" <shp@discussions.microsoft.com> wrote in message news:9B245A9E-36C7-4D33-915E-4BE54BFAD7D3@microsoft.com... > Wnat to know how to delete one of these headings so as to enable keyboard > access rather than just the mous...

best practice with intranet security and menu structure
Here goes the scenario.. The intranet is using windows Auth integrated wih Active Directory. Which is fine and all the appropriate Roles/Groups are set. When a user clicks on a button on a page he/she is prompted and logs on and authorisation takes place and he gets redirected to the page depending on the GROUP/ROLES they belong to in the active directory. On the pages they have treeview webcontrol as a menu structure and the Datasource is an XML file. But the thing is each of the pages has got a different XML because they don't want them to see the same links(menu). And in that case its v...

Add new master to stencil with VB .NET
Hi folks, I have created a Ribbon-Add-In for Microsoft Visio with Visual Studio 2010 and I really like doing this so far, but I have one major problem that I can't get over. I try to dynamically change the stencil by reacting to events like ShapeAdded. I managed to delete a master from the stencil by doing something like this: vsoMaster.Delete() However, if I want to add a new master to an empty stencil (after all masters have been deleted) I do this: Dim vMaster = vsApplication.Documents.Item("test.vss").Masters.Add() This produces an empty master in the stencil. Now, if I...

About System Menu
How to popup system menu in a no titlebar windows? ...

How to Run DocBook with .NET
There is a number of limitations in the built-in Microsoft .NET Framework XslTransform (System.Xml.Xsl.XslTransform) class which makes Microsoft .NET XSLT compiler incompatible with DocBook stylesheets. Altsoft provides the patch for the latest docbook-xsl version (1.68.1) that fixes these problems in FO stylesheets. For the technical details and to download the patch see: http://alt-soft.com/support_kb_docbook_and_net_xsltransform.jsp Best Regards, Altsoft Xml2PDF Team http://alt-soft.com/products_xml2pdf.jsp ...

Context menu opens on wrong monitor in dual-monitor setup
Hi, Using two monitors -- main on right; secondary on left. When I click a context menu in Dreamweaver on a panel that is on the secondary monitor, the menu opens all the way on the right side of the right hand monitor. I have tried everything I can think of, and the problem persists. Anyone have any ideas? Thank you. John does this happen with any other software? John Blaustein wrote: > Hi, > > Using two monitors -- main on right; secondary on left. When I click a > context menu in Dreamweaver on a panel that is on the secondary monitor, the &...

VC.NET iostream.h not found
Hi, I am using rouge wave headers distributed on Solaris. The include path is \rogue\rw. The development environment is Windows XP & Micsoroft Visual C++ 2003.NET I have mapped the solaris path onto windows machine and am using the include directory as $(ROGUE_INCLUDE) inside the .NET development environment. However, I am constantly getting compilation errors as:- rogue\rw\rstream.h(111) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory for line:- # ifdef __GLOCK__ # include <iostream.hxx> # else # ifndef RW_...

Maintaining the selected row after sorting an ASP.NET DataGridView
How can I maintain the same selected row even after a sort on a DataGridView with multiple pages? I have been looking for an example for weeks and still no luck, so help would be appreciated. Thanks Hi, >How can I maintain the same selected row even after a sort on a DataGridView >with multiple pages? >I have been looking for an example for weeks and still no luck, so help >would be appreciated. >Thanks As far as I know there's no DataGridView control in ASP.NET. I assume you mean GridView. You may refer to the following code. If you mean DataGr...