More in this section
Blogs RSS feed

Showing 3rd Party RSS Feeds

by User Not Found
**Sample Code is Available Here**




You can show RSS Feeds from 3rd party websites because RSS Feed data is in XML, so you just need to load it into a dataset, select a table from it, and bind it to a data-bound control. This article will discuss this process.




The sample code is available for this project above. Please copy and paste the code into your project. In the Web.config, paste this code in between the <toolboxControls> tags:


<add name="RadGridXMLFeed" section="Integration" url="~/UserControls/Integration/RadGridXMLFeed.ascx" 
         description="RadGrid XML Feed" /> 


For more info on uploading controls, please read this article.

End Result

Once the control is dragged and dropped onto a page, here is the end result (using today's RSS Feed):



How it Works

When you click edit on the control, a dialog with a text box appeared. I used a control designer for this feature and for more info on creating these designers, please read this blog post

I created a method for taking in an RSS Feed location, feeding the XML data into a data set and selecting a table to bind a RadGrid. Here is the code:


using System; 
using System.Data; 
using Telerik.Web.UI; 
public partial class RadGridXMLFeed : CustomControlBase 
    protected void Page_Load(object sender, EventArgs e) 
        RadGrid1.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource); 
    void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        //Make sure an RSS Feed has been specified before binding the data 
        if (!String.IsNullOrEmpty(MyNewsFeed)) 
            BindGrid(MyNewsFeed, 3, RadGrid1); 
            ErrorLabel.Text = "Please specify an RSS Feed for this control."
    /// <summary> 
    /// Binds grid to XML data source of rss feed 
    /// </summary> 
    /// <param name="strRss"></param> 
    /// <param name="iTable"></param> 
    /// <param name="RadGrid1"></param> 
    public void BindGrid(string strRss, int iTable, RadGrid RadGrid1) 
            //Make sure an RSS Feed has been specified before binding the data 
            if (!String.IsNullOrEmpty(strRss)) 
                DataSet Ods = new DataSet(); 
                RadGrid1.DataSource = Ods.Tables[iTable]; 
        catch(Exception ex) 
            ErrorLabel.Text = "I am sorry, but that RSS Feed won't work with this control. Please try another one.";  

To get an RSS feed from Thomson Reuters, follow these steps:


  1. Go to this URL:
  2. Right click on an RSS Feed
  3. Select Copy Link location
  4. Copy and paste the link into the control designer as shown below:
control desginer

1 comment

Leave a comment
  1. Gray.Blog Jun 02, 2009
    Pingback from:

    Leave a comment