Issues with xmldatasource databind in listview

2 posts, 0 answers
  1. Shannnon
    Shannnon avatar
    31 posts
    Member since:
    Oct 2010

    Posted 21 Feb 2011 Link to this post

    I have a ListView bind to xmldatasource, but I cannot make it work as the online demo does, it keeps saying "

    DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor' does not contain a property with the name 'Street'.

    "..when I changed the syntax from  <%#Eval("Street")%> to <%#XPath("Address/Street")%>, it kinda works but only pull out data under the first child node, the rest never got databinded. The xml file is like below:
    <data>
      <Address>
        <Id>1000</Id>
        <Street>1234 S 1st St. </Street>
        <City>LOS ANGELES</City>
        .......
       </Address>
       <Address>
        ......
       </Address>
    </data>
     Here is my xmldatasource: 
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                DataFile="~/sample1.xml" XPath="data"></asp:XmlDataSource>

    Any suggestions?

    Thanks a lot!

    Shan

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 24 Feb 2011 Link to this post

    Hi Shannnon,

    Try modifying the xml file as below:

    <data>
      <Address Id="1000" Street="1234 S 1st St." City="LOS ANGELES" />
    ...
    </data>


    Kind regards,
    Iana
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top