There is an error in XML document?

8 posts, 1 answers
  1. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 23 Feb 2011 Link to this post

    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
  2. Answer
    Kate
    Admin
    Kate avatar
    1898 posts

    Posted 25 Feb 2011 Link to this post

    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!
  3. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 25 Feb 2011 Link to this post

    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
  4. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 25 Feb 2011 Link to this post

    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
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 25 Feb 2011 Link to this post

    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!
  6. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 28 Feb 2011 Link to this post

    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
  7. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 28 Feb 2011 Link to this post

    I found the NavigateUrl attribute instead of URL from another post and that was what I was missing.

    Thanks,

    Morgan
  8. Morgan
    Morgan avatar
    8 posts
    Member since:
    Jan 2009

    Posted 28 Feb 2011 Link to this post

    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>
Back to Top