Pretty RSS Feed Display

This demo illustrates displaying the RSS <item> elements from a remote RSS feed using a DataGrid. This demo differs from the previous demo in that the DataGrid's aesthetic properties are set so that the appearance is more eye-pleasing. (Also note that the data shown in this demo is a snapshot of the RSS feed's data from Monday, March 17th. A static RSS feed is used to reduce load on the ASPMessagboard.com server.)


20 Most Recent ASPMessageboard.com Posts
How To: Build Claims-Aware ASP.NET Web Forms Application Using WIF (Sat, 21 Jul 2018 06:45:27 GMT)
Request/response tracing - HealthVault Development (Sat, 21 Jul 2018 03:38:01 GMT)
ASP.NET code security permissions - HealthVault Development (Sat, 21 Jul 2018 03:38:00 GMT)
Deploy Office Web Apps Server (Sat, 21 Jul 2018 00:31:55 GMT)
Getting Started with ASP.NET Core - Visual Studio for Mac (Fri, 20 Jul 2018 23:49:42 GMT)
Razor - Visual Studio for Mac (Fri, 20 Jul 2018 23:49:42 GMT)
XML Editor Schema Cache - Visual Studio (Fri, 20 Jul 2018 23:49:38 GMT)
Configure the ASP.NET Profiler for Load Tests in Visual Studio - Visual Studio (Fri, 20 Jul 2018 23:49:36 GMT)
Create a Visual Studio Add-In for the Web Performance Test Results Viewer - Visual Studio (Fri, 20 Jul 2018 23:49:36 GMT)
Create a Test Setting for a Distributed Load Test in Visual Studio - Visual Studio (Fri, 20 Jul 2018 23:49:36 GMT)
Creating Application Pages for SharePoint - Visual Studio (Fri, 20 Jul 2018 23:49:35 GMT)
Analyze CPU usage data (ASP.NET) - Visual Studio (Fri, 20 Jul 2018 23:49:35 GMT)
How to: Modify Web.Config Files to Instrument and Profile Dynamically Compiled ASP.NET Web Applications - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
How to: Instrument a Statically Compiled ASP.NET Web Application and Collect Detailed Timing Data with the Profiler by Using the Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
How to: Instrument a Dynamically Compiled ASP.NET web Application and Collect Memory Data by Using the Profiler Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
How to: Instrument a Dynamically Compiled ASP.NET Web Application and Collect Detailed Timing Data with the Profiler by Using the Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
Collect concurrency data for Stand-Alone Applications by Using the Profiler Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
Collecting Memory Data from an ASP.NET Web Application by Using the Profiler Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
Collecting Detailed Timing Data for Services by Using the Instrumentation Method from the Profiler Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)
Collecting Detailed Timing Data for a Stand-Alone Application by Using the Profiler Command Line - Visual Studio (Fri, 20 Jul 2018 23:49:34 GMT)


Source Code
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data" %>
<script language="VB" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)
    recentPosts.DataSource = GetRSSFeed("http://www.asp.net/news/rss.ashx")
    recentPosts.DataBind()      
  End Sub


  Function GetRSSFeed(strURL as String) as DataTable
    'Get the XML data
    Dim reader as XmlTextReader = New XmlTextReader(strURL)
    
    'return a new DataSet
    Dim ds as DataSet = New DataSet()
    ds.ReadXml(reader)    
    Return ds.Tables(2)
  End Function
</script>
  
<asp:DataGrid runat="server" id="recentPosts" AutoGenerateColumns="False"
     Font-Name="Arial" Font-Size="10pt"
     HeaderStyle-Font-Bold="True"
     HeaderStyle-HorizontalAlign="Center"
     HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White"
     HeaderStyle-Font-Size="15pt"
     AlternatingItemStyle-BackColor="#eeeeee">
  <Columns>
    <asp:TemplateColumn HeaderText="20 Most Recent ASPMessageboard.com Posts">
      <ItemTemplate>
        <a href="<%# DataBinder.Eval(Container.DataItem, "link")%>">
          <%# DataBinder.Eval(Container.DataItem, "title") %>
        </a> (<i><%# DataBinder.Eval(Container.DataItem, "pubDate") %></i>)
      </ItemTemplate>
    </asp:TemplateColumn>
  </Columns>
</asp:DataGrid>

[Return to the article]