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

Issues with xmldatasource databind in listview

1 Answer 124 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Shannnon
Top achievements
Rank 1
Shannnon asked on 21 Feb 2011, 07:57 PM
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

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 24 Feb 2011, 01:12 PM
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!
Tags
ListView
Asked by
Shannnon
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or