Consuming RSS Feeds using ASP.net controls


Real simple example, using an XmlDataSource and my new super best friend, the ListView control;

    <asp:ListView ID="RSSList" runat="server" DataSourceID="RSSData">
        <LayoutTemplate>
            <ul>
                <li id="itemPlaceholder" runat="server" />
            </ul>
        </LayoutTemplate>
        <ItemTemplate>
            <li><h2>
                <%#XPath("title") %>
            </h2>
            
            <%#XPath("author") %>
            <a href='<%#XPath("link") %>' title=''>View Original Post</a>
            </li>
        </ItemTemplate>
    </asp:ListView>
    <asp:XmlDataSource 
        ID="RSSData" 
        runat="server" 
        DataFile="http://www.shawson.co.uk/codeblog/feed/"
        XPath="rss/channel/item">
    </asp:XmlDataSource>
  1. No comments yet.
(will not be published)