Why does Response.Write() only write the first element in list?

ELLE

New Member
I am trying to write some syndication onto my page, I use the .Net class to get the rss content into a list \[code\]<div> <% var r = System.Xml.XmlReader.Create("http://www.huffingtonpost.com/feeds/verticals/small-business/index.xml"); System.ServiceModel.Syndication.SyndicationFeed albums = System.ServiceModel.Syndication.SyndicationFeed.Load(r); r.Close(); foreach (System.ServiceModel.Syndication.SyndicationItem album in albums.Items) { Response.Write(album.Title.Text); } %></div>\[/code\]Well the \[code\]foreach\[/code\] is only functioning as a forfirst here, because it only writes the first SyndicationItem in the list. As you can see, there are many items in that list. Where can be my mistake? Just to make sure there is not only 1 item in my album list, I did a count on it. \[code\]<div> <% var r = System.Xml.XmlReader.Create("http://www.huffingtonpost.com/feeds/verticals/small-business/index.xml"); System.ServiceModel.Syndication.SyndicationFeed albums = System.ServiceModel.Syndication.SyndicationFeed.Load(r); r.Close(); int i = albums.Items.ToList().Count; Response.Write(i); /* foreach (System.ServiceModel.Syndication.SyndicationItem album in albums.Items) { Response.Write(album.Title.Text); } */ %> </div>\[/code\]Result:
mbWuw.png
 
Back
Top