Loading XML into TreeView

3 posts, 0 answers
  1. Jerry
    Jerry avatar
    41 posts
    Member since:
    Mar 2012

    Posted 28 Mar 2014 Link to this post

    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. Jerry
    Jerry avatar
    41 posts
    Member since:
    Mar 2012

    Posted 28 Mar 2014 in reply to Jerry Link to this post

    I forgot to add my code:

    XmlDocument xml = new XmlDocument();
    xml.Load(@"C:\XMLFile1.xml");
    MyTree.DataSource = xml;
    MyTree.DataBind();
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 02 Apr 2014 Link to this post

    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.

     
Back to Top