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
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