From the June 2013 Issue of Prestwood eMag
 
C# WebForms Coding Tasks:
Consuming an RSS feed in ASP.NET
 
Posted 5/1/2010 on 5/1/2010
C# Code Snippet:

KB102107

Using this quickie code snippet, you can attach an ASP:Gridview  to an external RSS Feed.

All you need to accomplish this is the URL of a usable feed.

Syntax Example:

Create a ASP AJAX webform, and drop in a GRIDVIEW control, and a button.  Double click the button control and add this code.  You'll need to add these two namespaces to your using section.

using System.Xml;
using System.Data;

This snippet will fill it with DICE ASP.NET open postings.

protected void Button1_Click(object sender, EventArgs e)
{
    XmlTextReader myReader = new
XmlTextReader("http://rss.dice.com//system/net-jobs.xml");
    DataSet myDataSet = new DataSet();
    myDataSet.ReadXml(myReader);
    GridView1.DataSource=myDataSet.Tables[3];
    GridView1.DataBind();
}

Comments

1 Comments.
Share a thought or comment...
Comment 1 of 1

how to integrate in Integrating Partial Rendering into an Existing. Project this is

Posted 12/31/2018
Code Contributed By Bryan Valencia:

Bryan Valencia is the author of millions of lines of code and writes for PrestwoodBoards and Visual Studio Journey on-line magazines.

Visit Profile
www.prestwood.com For service: 916-726-5675
or support@prestwood.com
Copyright (C) Prestwood IT Solutions.
All Rights Reserved.
Printed 9/25/2021