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

Loading XML into TreeView

2 Answers 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 28 Mar 2014, 07:19 PM
I have XML that is coming back from my database and I'm databinding it to my TreeView, but it shows:

System.Xml.XmlDeclaration
System.Xml.XmlElement

as part of my tree. 

Here is my XML:

<?xml version="1.0" encoding="utf-8" ?>
<tree>
  <node text="2014">
    <node text="Test 1">
      <node text="Test 2">
        <node text="Test 3" />
        <node text="Test 4" />
      </node>
    </node>
  </node>
  <node text="2013">
      <node text="Test 1">
        <node text="Test 2">
          <node text="Test 3" />
          <node text="Test 4" />
        </node>
      </node>
  </node>
</tree>

I need my tree to display it like this with checkboxes next to it.
2014
-Test 1
---Test 2
------Test 3
------Test 4
2013
-Test 1
---Test 2
------Test 3
------Test 4

Thank you for any help.

2 Answers, 1 is accepted

Sort by
0
Jerry
Top achievements
Rank 1
answered on 28 Mar 2014, 07:21 PM
I forgot to add my code:

XmlDocument xml = new XmlDocument();
xml.Load(@"C:\XMLFile1.xml");
MyTree.DataSource = xml;
MyTree.DataBind();
0
Boyan Dimitrov
Telerik team
answered on 02 Apr 2014, 12:49 PM
Hello Jerry,

I would suggest reviewing our Loading XML Content article that explains how to populate your RadTreeView control with XML content.

Regards,
Boyan Dimitrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
Jerry
Top achievements
Rank 1
Answers by
Jerry
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or