xmldatasource error

2 posts, 0 answers
  1. Silver
    Silver avatar
    25 posts
    Member since:
    Feb 2012

    Posted 21 May 2012 Link to this post


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

  2. Plamen
    Plamen avatar
    3079 posts

    Posted 23 May 2012 Link to this post

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