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

xmldatasource error

1 Answer 24 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Silver
Top achievements
Rank 1
Silver asked on 21 May 2012, 11:46 PM
Hi,

I am getting below error while trying to xmldatasource with treeview. I gave sample xml and code.

System.Web.UI.WebControls.XmlHierarchyData does not contain a property with the name 'Text'

<telerik:RadTreeView ID="RadTreeView2" runat="server" DataSourceID="XmlDataSource1">
    <DataBindings>
        <telerik:RadTreeNodeBinding DataMember="Node" TextField="Text" ImageUrlField="ImageUrl" ExpandedField="Expanded" />
    </DataBindings>
</telerik:RadTreeView>
<asp:XmlDataSource runat="server" ID="XmlDataSource1" DataFile="TreeView.xml" XPath="/Tree/Node" />
 
<?xml version="1.0" encoding="utf-8" ?>
<Tree>
  <Node>
    <Node Text="Top Admin" Value="Top Admin" ImageUrl="sample.ico" >
    <Node>
     
        <Node Expanded="False"  Text="Second" Value="Second">
          <Node>
            <Node Text="Actual" NavigateUrl="~/Actual.aspx" Expanded="False" ></Node>
          </Node>
        </Node>
     
    </Node>
    </Node>
  </Node>
</Tree>


1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 23 May 2012, 08:54 AM
Hi Silver,

The issue is caused because each node tag in the xml file should have a text property in it and you should not have tag like "<Node>" one with no properties. You can review the TreeView.xml file shown in the Populating from XML on-line demo.

Hope this will explain the issue.

Kind regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Silver
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or