I have been trying to populate the Webmenu with items from an XML file. Everything works great except for the fact that I can only seem to get one main item (parent) on the menu. If I try to add more an error informing me that only one root is allowed pops up. Does anyone have a sample XML file that successfully populates a Webmenu?
Thanks
(I have posted this in another thread too. It is relevant here too so I hope no-one objects. I found the link unhelpful)
Have a look at this example below. I did not find the documentation very helpful and got to this by trial and error. There are a few tricks to get this working.
1. To get rid of the "root" men (and possible an "Item" Menu) you must add "/root/Item" as the Xpath expression when you Configure Data Source
2. Do not enclose your sub Items within <Items></Items> tags as you will just get a submenu called Items. Likewise do not create <Images> tags as they are not necessary. The markup when you preset a menu has these tags and so, in the absence of any samples (Infragistics please note) you may be fooled into thinking these are required.
3. Bind the Item tag once and set the Depth to -1. The documentation example (and I only found anything useful in the NET 8.3 docs) has 2 levels of Menu and sets the Depth to 2. This is confusing as the result is that the you get 2 levels of menu with the text "Item" in them. The example has a top menu with just the word "Item" - I think duh! is appropriate here. Why -1 I don't know. And no you can't change /root/Item in the Xpath to /root and then set Depth to 0.
4. In the Item Binding set ImageUrlField to "ImageUrl", TargetUrlField to "TargetUrl" and TextField to "Text". I am not sure whether these could ever be set to anything else meaningful. Anyway these are what did it in my example below
The example works fine as a Horizontal menu. I have tested this in a simple example but not yet implemented it in the full application where I have made menu changes using code, as 4 months ago I could not figure the XML at all.