This is a migrated thread and some comments may be shown as answers.

There is an error in XML document?

7 Answers 139 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 1
Morgan asked on 23 Feb 2011, 10:14 PM
Following the instructions on the website, I am generating the XML below, but the control refuses to load it
The control says the error is at line 215, which corresponds to the bold section below.

Essentially I am trying to create 3 parent items, 1 of which has 1 item with a sub-menu item within it.

I am loading the XML into an XMLDocument to validate the structure, so I don't understand what the problem is.


<Menu>
<Group Text='Home' URL='#'></Group>
<Group Text='Corporate' URL='#'>
    <Item Text='child page 1' URL='PageView.aspx?ContentId=2'>
  <Group>
       <Item Text='page level 2' URL='PageView.aspx?ContentId=3'/>
  </Group>
</Item>
</Group>
<Group Text='Tools' URL='#'></Group>
</Menu>

Thanks,

Morgan

7 Answers, 1 is accepted

Sort by
0
Accepted
Kate
Telerik team
answered on 25 Feb 2011, 09:15 AM
Hello Morgan,

The issue is that under the Menu tag you can have only one <Group> tag. It is the same scenario when you have an <Item> tag. You can place only one <Group> tag in it. However, to achieve the desired effect, you can place as may <Item> tags as you need as demonstrated in the sample page that I have attached.

Best wishes,
Kate
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Morgan
Top achievements
Rank 1
answered on 25 Feb 2011, 02:08 PM
Hi Kate,

The control works fine when using an actual XML file. The snippet in the original post is XML I am generating from a database. I am passing the XML to the GetXML method of the control and it is bombing out saying the XML is invalid.

Thanks,

Morgan
0
Morgan
Top achievements
Rank 1
answered on 25 Feb 2011, 02:10 PM
And I was generating the XML structure you show in the XML file and it was not working with that structure either, so I changed the structure per the online documentation for passing an XML string to the GetXML method and I'm still not having any luck.

Thanks,

Morgan
0
Kate
Telerik team
answered on 25 Feb 2011, 04:17 PM
Hi Morgan,

Unfortunately, I can not reproduce the issue that you encounter. I will need more information about what exactly you use and how you use it to be able to get the issue and to help you resolve it.

Regards,
Kate
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Morgan
Top achievements
Rank 1
answered on 28 Feb 2011, 04:47 PM
Hi Katie,

I managed to get the menu to render, but I'm having an issue with the URL attribute not being used by the menu item.
Here is a sample node:
<Item Text='child page 1' url='PageView.aspx?ContentId=2'>

The url is being converted to # for all menu items.

The sample code here http://www.telerik.com/help/aspnet-ajax/menu_itemsxml.html does not show the url attribute in the nodes, so I'm at a loss on how to get the menu item to read the URL.

Thanks,

Morgan
0
Morgan
Top achievements
Rank 1
answered on 28 Feb 2011, 04:54 PM
I found the NavigateUrl attribute instead of URL from another post and that was what I was missing.

Thanks,

Morgan
0
Morgan
Top achievements
Rank 1
answered on 28 Feb 2011, 04:58 PM
For anyone that is interested, my XML looks like this...
<Menu>
<Group>
<Item Text='Home' NavigateUrl='#'>
<Item Text='Item With Child'  NavigateUrl='#'> <Item IsSeparator='True'/>
<Item Text='Chid' NavigateUrl='PageView.aspx?ContentId=2'>
<Item IsSeparator='True'/>
<Item Text='Grandchild' NavigateUrl='PageView.aspx?ContentId=3'/>
</Item>
</Item>
</Menu>
</Group>
Tags
Menu
Asked by
Morgan
Top achievements
Rank 1
Answers by
Kate
Telerik team
Morgan
Top achievements
Rank 1
Share this question
or