Binding an RSS Feed with an XmlDataSource

I'm sure this has been blogged on a zillion times before, but this is super easy.  Look!

image

Here is the code as text (so you can copy and paste :)

<asp:XmlDataSource ID="xmlRSS"            
    DataFile="http://www.asp.net/community/articles/rss.ashx"
    EnableCaching="true"
    CacheDuration="3600"           
    XPath="rss/channel/item"
    runat="server"/>
<asp:Repeater ID="rptRSS" runat="server" DataSourceID="xmlRSS">
    <ItemTemplate>
        <p>
            <a href='<%#XPath("link")%>' target="_blank"><%#XPath("title")%></a>
        </p>
    </ItemTemplate>       
</asp:Repeater>

 

More later - j.

No Comments