Click here to Skip to main content
Click here to Skip to main content

Tagged as

Read RSS FEED data (blogspot.com)

, 10 Nov 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Read RSS FEED data (blogspot.com)
In this post, we will see how to read RSS Feed data & show it on our web site.
To start with, we need to know from where we are going to read RSS feed data. In this example, we will read RSS feed data from blogger.com site, where recent posts are available.
Let’s say there is a blog spot as http://xxxxxx.blogspot.com, then RSS feed data would be available at http://xxxxx.blogspot.com/rss.xml. So this is the source data for us to work with.
Now start with code part:
 
  1. First let's add DataGrid to our web page, with one template column as shown below:
            <asp:DataGrid runat="server" ID="myPosts" AutoGenerateColumns="False">
                <columns>
                    <asp:TemplateColumn HeaderText="My Posts">
                        <itemtemplate>
                            <a href="<%# DataBinder.Eval(Container.DataItem, " link=")%>">
                                <%# DataBinder.Eval(Container.DataItem, "title") %>
                            </a>
                        </itemtemplate>                
                </columns>       
    
  2. In our page load, let's declare XMLTextReader object & this will take RSS FEED URL. In this example, I am using my blogspot URL:
    XmlTextReader reader = new XmlTextReader("http://bgsuryablog.blogspot.com/rss.xml");
     
  3. We will declare Dataset:
    DataSet ds = new DataSet();
     
  4. To read XML data & read into DS, let's use the below code:
    ds.ReadXml(reader);
     
  5. As we have dataset object filled up with RSS feed data, let's assign Dataset to datagrid as below:
    myPosts.DataSource = ds;
    myPosts.DataBind();
     
  6. Dataset object would contain properties in the form of Link & Title, which we have used in our .aspx code i.e. step 1.
     
  7. Now execute the code & see the output.
 
Happy coding… hope this helps!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bangla Gopal Surya Prakash
Software Developer (Senior)
United States United States
B.Tech graduate in CSE, having experience in .Net related Technologies
 
Microsoft Certified Technical Specialist in .NET Framework 2.0
Microsoft Certified Technical Specialist in .NET Framework 4.0
 
My interests are Coding, reading [technical stuff] and listening to music, playing Cricket, Table Tennis
 
http://bgsuryablog.blogspot.com/

Comments and Discussions

 
Questioncommnet PinmemberSarah MQ16-Feb-14 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 10 Nov 2011
Article Copyright 2011 by Bangla Gopal Surya Prakash
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid