Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6117427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:19:09+00:00 2026-05-23T15:19:09+00:00

I am a novice C# programmer, trying to create a simple RSS/Atom aggregator webpart

  • 0

I am a novice C# programmer, trying to create a simple RSS/Atom aggregator webpart for a SharePoint site (I can’t use the ootb part as I don’t have an Enterprise licence).

I have 3 buttons:

  1. New Feed, which takes a URI from the user and attempts to construct a label displaying the feed and add it to this.Controls;
  2. Clear Feeds, which clears all the displayed feeds (removing them from this.Controls)
  3. Default Feeds, which takes an ArrayList of default URIs and converts them each into labels (also adding them to this.Controls).

Clearing the feeds works fine, as does reverting to the defaults. However, after clearing all the feeds and trying to add a new feed, the defaults are added as well (and only one new feed can be added at a time, the new one overwriting the old). I suspect this is because I don’t fully understand the add/remove controls function. Code follows below:

    ArrayList viewedFeeds = new ArrayList(); 
    ArrayList defaultFeeds = new ArrayList(); //Contains several default feeds, e.g. BBC news (http://feeds.bbci.co.uk/news/rss.xml)

    private void newFeed_Click(object sender, EventArgs e)
    {
        renderFeed(userText.Text);
    }

    private void clearFeeds_Click(object sender, EventArgs e)
    {
        clearAllFeeds();
    }

    private void defaultFeeds_Click(object sender, EventArgs e)
    {
        clearAllFeeds();
        initialiseFeedViewer();
    }

    private void clearAllFeeds()
    {
        foreach (Label feed in viewedFeeds)
        {
            this.Controls.Remove(feed);
        }
        viewedFeeds.Clear();
    }

    private void initialiseFeedViewer()
    {
        foreach (string uri in defaultFeeds)
            renderFeed(uri);
    }

    private void renderFeed(String uri)  
    {
        try  
        {  
            Label feed = new Label();

            // Create a Syndicated feed reader, parse the XML and add the relevant text to the label "feed"
            feed.BorderStyle = System.Web.UI.WebControls.BorderStyle.Double;
            viewedFeeds.Add(feed);
            this.Controls.Add(feed);
        }
        catch (Exception ex)
        {   
            //Print an error message (e.g. If the URI does not link to a suitable feed
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:19:10+00:00Added an answer on May 23, 2026 at 3:19 pm

    It turns out I was calling initialiseFeedViewer() more than once – it was in the createChildControls() method. I assumed this was only called once, similar to a constructor, but it seems to be called every time the page is loaded.

    This has the annoying side effect of clearing all of my variables, so the List<Label>s I’m using to keep track of displayed feeds are rendered useless.

    I’ll attempt to get around this by storing them in a Sharepoint List instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I notice in several API's, that you may create a struct which is used
I have a project that adds elements to an AutoCad drawing. I noticed that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.