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

Using the same XML with RadMenu and RadTreeView

1 Answer 89 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 17 May 2011, 03:59 PM
Hi,

Is it possible to use the same XML data source for both a RadMenu and a RadTreeView?

I am trying to convert an existing (non-Telerik) menu administration page over to use Telerik controls.  The page displays the menu XML data as a tree view and allows the users to edit, add, and delete nodes.  The XML content is in a database and is loaded using the LoadXML() method.  Upon saving changes, the data is serialized back out using GetXML(), and the XML is written back to the database.

The reason I ask is because the XML formats for the two controls listed in the documentation are different:

RadMenu XML Format
<Menu Skin="Outlook">
    <Item Text="Parent" LeftLogo="Img\parent.gif" >
        <Group Width="140" Flow="Vertical">
            <Item Text="Child 1" />
            <Item IsSeparator="True" />
            <Item Text="Child 2" />
        </Group>
    </Item>
</Menu>

RadTreeView XML Format
<Tree>
  <Node Text="North America" Expanded="True" Value="1">
    <Node>
       <Node>
       </Node>
    </Node>
  </Node>
</Tree>


If it is not possible to load RadMenu XML data into a RadTreeView item directly, do you have any suggestions on how to achieve the same or similar effect?

Thanks,
Kevin

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 20 May 2011, 11:14 AM
Hello Kevin,

You could use one and the same xml file for the different controls but you will need to bind them in a different way. For example in case you have the structure of the menu in an xml file you can bind it to a menu control using the LoadXML() method. However, if you need to bing the same xml file to a control different then the menu you will need to use the xml datasource method to bind it (via this method you can specify the different fields and the way they will be bind to the control) . You can refer to these articles on how to bind a control using xml datasource:Binding a Tabular Control to the XmlDataSource Control, XmlDataSource Class. I would also suggest that you look up on the internet about the different xml binding methods.

Kind regards,
Kate
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Menu
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or