Saturday, June 19, 2010

Consuming RSS Feeds and Displaying it using XMLDataSource & ListView (so easy)

Im still exploring dataPager control, and found this.
how i can easily display rss feed using (xmldatasource) & (dataList). I did this before the hard manual way, and again via (LINQ) but this seems the most decent and easiest way

        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://www.microsite.reuters.com/rss/topNews"
            XPath="rss/channel/item"></asp:XmlDataSource>
        <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1" BorderColor="Tan"
            BackColor="LightGoldenrodYellow" BorderWidth="1px" CellPadding="2" ForeColor="Black"
            Width="600px">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# XPath("pubDate") %>'></asp:Label><br />
                <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link") %>'
                    Target="_blank"></asp:HyperLink><br />
                <%# XPath("description") %>
            </ItemTemplate>
        </asp:DataList>



Info from: http://geekswithblogs.net/evjen/archive/2004/07/23/8792.aspx



No comments: