Displaying an XML RSS blog feed : RSS « Development « ASP.NET Tutorial






<%@ Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>XmlDataSource</title>
    </head>
    <body>
    <form id="form1" runat="server">
        <asp:DataList ID="DataList1" Runat="server" DataSourceID="XmlDataSource1">
            <HeaderTemplate>
                <table border="1" cellpadding="3">
            </HeaderTemplate>
            <ItemTemplate>
                <tr><td><b><%# XPath("title") %></b><br />
                <i><%# XPath("pubDate") %></i><br />
                <%# XPath("description") %></td></tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr bgcolor="LightGrey"><td><b><%# XPath("title") %></b><br />
                <i><%# XPath("pubDate") %></i><br />
                <%# XPath("description") %></td></tr>
            </AlternatingItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:DataList>
        <asp:XmlDataSource ID="XmlDataSource1" 
                           Runat="server" 
                           DataFile="http://www.hanselman.com/blog/SyndicationService.asmx/GetRss" 
                           XPath="rss/channel/item">
        </asp:XmlDataSource>
    </form>
    </body>
</html>








9.37.RSS
9.37.1.Displaying an XML RSS blog feed
9.37.2.Rss Reader