'Anil' Radhakrishna's Code Gallery

Home | Blog
Web Development Tips, Tricks & Trivia

DIY: Build a frill-free feed aggregator

<%@ Page Language="C#" %>

<%@ Register Assembly="RssToolkit" Namespace="RssToolkit.Web.WebControls" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Timer1_Tick(object sender, EventArgs e)
    {
        Label1.Text = "Page refreshed at: " +
          DateTime.Now.ToLongTimeString();
        GridView1.DataBind();
    }
    void Page_Load(object sender, EventArgs e)
    {
        Label2.Text = "Page created at: " +
          DateTime.Now.ToLongTimeString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>My frill-free ASP.NET Forums feed aggregator</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        </div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick">
                </asp:Timer>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                <cc1:RssDataSource ID="RssDataSource1" runat="server" MaxItems="10" Url="http://forums.asp.net/aggregaterss.aspx?Mode=1">
                </cc1:RssDataSource>
                &nbsp;
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="RssDataSource1">
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="link" DataTextField="title" HeaderText="Title" />
                        <asp:BoundField DataField="description" HeaderText="description" SortExpression="description"
                            HtmlEncode="False" />
                        <asp:BoundField DataField="pubDate" HeaderText="pubDate" SortExpression="pubDate" />
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
    </form>
</body>
</html>

Read related blog posting
Code formatted with Thomas Johansen's utility..