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
about_Preference_Variables (Fri, 19 Oct 2018 03:04:59 GMT)
How to use Outlook REST APIs in an ASP.NET MVC app (Thu, 18 Oct 2018 23:49:40 GMT)
Expired sessions are not being deleted from the ASP.NET Session State database (SharePoint Server) (Thu, 18 Oct 2018 23:02:10 GMT)
Monitor cache performance in SharePoint Server 2016 (Thu, 18 Oct 2018 23:02:09 GMT)
Maintain RBS in SharePoint Server (Thu, 18 Oct 2018 23:02:09 GMT)
Migrate an ASP.NET Web application to an Azure Virtual Machine (Thu, 18 Oct 2018 20:15:23 GMT)
Client (Thu, 18 Oct 2018 20:15:23 GMT)
Token.OnPreRender(EventArgs) Method (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Report Constructor (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Embed.WorkspaceId Property (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Microsoft.PowerBI.AspNet.WebForms.UI.WebControls Namespace (Thu, 18 Oct 2018 20:14:22 GMT)
Token Constructor (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Token.AccessToken Property (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Report Class (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Token.Render(HtmlTextWriter) Method (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Report.TagName Property (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Embed.GetEmbedUrl Method (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Token Class (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Embed.Render(HtmlTextWriter) Method (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 GMT)
Report.AddAttributesToRender(HtmlTextWriter) Method (Microsoft.PowerBI.AspNet.WebForms.UI.WebControls) (Thu, 18 Oct 2018 20:14:22 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]