troubleshooting Question

How can I display XML Data on a DetailsView ?

Avatar of darcosys
darcosys asked on
ASP.NETVisual Basic.NET
7 Comments1 Solution1812 ViewsLast Modified:
Hi

I want to display the information of a XML in a VB.NET (ASP.NET)  DetailsView control but I cannot solve it.

this one is the XML:

<?xml version="1.0" encoding="UTF-8" ?>
<city>
    <host>kochavchadash.myminicity.com</host>
    <name>KochavChadash</name>
    <region code="IL">israel</region>
    <ranking>288</ranking>
    <population>129</population>
    <incomes>26100</incomes>
    <unemployment>0</unemployment>
    <transport>100</transport>
    <criminality>0</criminality>
    <pollution>0</pollution>
    <nextnuke>1</nextnuke>
    <signatures>0</signatures>
    <bases com="0" env="0" ind="27" sec="0" tra="7" />
</city>

I must read it from this link: http://kochavchadash.myminicity.com/xml

My Code:
  <div>
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://kochavchadash.myminicity.com/xml"></asp:XmlDataSource>

        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="XmlDataSource1" Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="host" HeaderText="host" />
                <asp:BoundField DataField="name" HeaderText="name" />
                <asp:BoundField DataField="ranking" HeaderText="ranking" />
            </Fields>
        </asp:DetailsView>
    </div>

The ERROR:
A field or property with the name 'host' was not found on the selected data source.

------------
Tk.
Carlos
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros