Display RSS Feeds Using XmlDataSource
Posted by Tihomir Ivanov on 17 November 2009 13:22
Rating: 0.00
It's very easy to display RSS Feeds using XmlDataSource and DataList:
Just copy the code below and replace the DataFile value with the RSS Feed url you want
<asp:XmlDataSource ID="RSSDataSource" Runat="server" DataFile="http://www.dev-the-web.com/blog/feed/"
XPath="rss/channel/item" EnableCaching="true" CacheDuration="300" CacheExpirationPolicy="Sliding" />
<asp:DataList ID="dlRSSItems" Runat="server" DataSourceID="RSSDataSource">
<ItemTemplate>
<li><a href='<%# XPath("link") %>'><%# XPath("title") %></a></li>
</ItemTemplate>
</asp:DataList>
That's all :)
Comments:
No comments yet.