Simple RSS Feed Display

This demo illustrates displaying the RSS <item> elements from a remote RSS feed using a DataGrid. Note that the code to accomplish this is about five lines long! (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.)


titledescriptionlinkpubDatechannel_Id
XhtmlTextWriter Class (System.Web.UI)Writes Extensible Hypertext Markup Language (XHTML)-specific characters, including all variations of XHTML modules that derive from XTHML, to the output stream for an ASP.NET server control for mobil…https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.xhtmltextwriterFri, 19 Oct 2018 18:31:00 GMT0
WebResourceAttribute.PerformSubstitution Property (System.Web.UI) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webresourceattribute.performsubstitutionFri, 19 Oct 2018 18:31:00 GMT0
WebResourceAttribute.WebResource Property (System.Web.UI) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webresourceattribute.webresourceFri, 19 Oct 2018 18:31:00 GMT0
WebResourceAttribute Class (System.Web.UI)Defines the metadata attribute that enables an embedded resource in an assembly. This class cannot be inherited. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webresourceattributeFri, 19 Oct 2018 18:31:00 GMT0
Xml.Render(HtmlTextWriter) Method (System.Web.UI.WebControls) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.xml.renderFri, 19 Oct 2018 18:31:00 GMT0
WebResourceAttribute.ContentType Property (System.Web.UI) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webresourceattribute.contenttypeFri, 19 Oct 2018 18:31:00 GMT0
Xml.AddParsedSubObject(Object) Method (System.Web.UI.WebControls) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.xml.addparsedsubobjectFri, 19 Oct 2018 18:30:59 GMT0
WebPartManager Class (System.Web.UI.WebControls.WebParts)Serves as the central class of the Web Parts control set, managing all the Web Parts controls, functionality, and events that occur on a Web page. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartmanagerFri, 19 Oct 2018 18:30:59 GMT0
WebPartZone Class (System.Web.UI.WebControls.WebParts)Serves as the primary control in the Web Parts control set for hosting controls on a Web page. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartzoneFri, 19 Oct 2018 18:30:59 GMT0
WebZone Class (System.Web.UI.WebControls.WebParts)Serves as the base class for all controls that act as containers for server controls (including Web Parts controls, server controls, and user controls) in Web Parts applications. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webzoneFri, 19 Oct 2018 18:30:59 GMT0
WebPartZoneBase.HelpVerb Property (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartzonebase.helpverbFri, 19 Oct 2018 18:30:59 GMT0
WebPartZoneBase.CreateVerbs Event (System.Web.UI.WebControls.WebParts)Occurs when the verbs are created for a zone that derives from the class. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartzonebase.createverbsFri, 19 Oct 2018 18:30:59 GMT0
WebPartZoneBase.OnCreateVerbs(WebPartVerbsEventArgs) Method (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartzonebase.oncreateverbsFri, 19 Oct 2018 18:30:59 GMT0
WebPartVerb Class (System.Web.UI.WebControls.WebParts)Provides an interactive user interface (UI) element that enables users to perform actions on a Web Parts page. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartverbFri, 19 Oct 2018 18:30:59 GMT0
WebPartZone Constructor (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartzone.-ctorFri, 19 Oct 2018 18:30:59 GMT0
WebPartVerb.Text Property (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartverb.textFri, 19 Oct 2018 18:30:59 GMT0
WebPartVerb.ImageUrl Property (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartverb.imageurlFri, 19 Oct 2018 18:30:59 GMT0
WebPartVerb.Enabled Property (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartverb.enabledFri, 19 Oct 2018 18:30:59 GMT0
WebPartVerb.Description Property (System.Web.UI.WebControls.WebParts) https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webpartverb.descriptionFri, 19 Oct 2018 18:30:59 GMT0
WebPartTransformer Class (System.Web.UI.WebControls.WebParts)Provides basic implementation for transformer classes to convert data between two incompatible connection points. https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.webparts.webparttransformerFri, 19 Oct 2018 18:30:59 GMT0


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" />

[Return to the article]