Repeater is not working.

S

Shapper

Hello,

I have a XML file with the following structure:

<channel>
<title>...</title>
<link>...</link>
<description>...</description>
<item>
<title>4 Web Version 1.0 is available since today!</title>
<link></link>
<description>...</description>
<pubDate>...</pubDate>
</item>
...

I am trying to get the all item nodes and display them in a
ASP:Repeater.
My code is as follows:

ASPX.VB
news.Load(Server.MapPath("xml/news.rss"))
rptNews.DataSource = news.SelectNodes("channel/item")
rptNews.DataBind()

ASPX
<asp:Repeater id="rptNews" runat="server">
<ItemTemplate>
<h1><%# DataBinder.Eval(Container.DataItem, "title") %></h1>
<p><%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}")
%></p>
<p><%# DataBinder.Eval(Container.DataItem, "description") %></p>
</ItemTemplate>
</asp:Repeater>

I get this error:
DataBinder.Eval: 'System.Xml.XmlElement' does not contain a property
with the name title.

What am I doing wrong here?

Thanks,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top