ASP.NET AJAX RC1 RSS Reader

So the other day I was adding a “news page” to one of my projects and thought it was a great chance to play with consuming some other RSS feeds that had related information to what I was working on. So I started looking round and found the RSS Toolkit that had an RSS Data Source control that is perfect for consuming RSS feeds – the toolkit actually does much more, you should have a read on Dmitry’s blog (he wrote the toolkit and in on the ASP.net team) download the toolkit here.

I have also used the ASP.net AJAX Toolkit (which if you are unaware is a collection of controls for use with ASP.net AJAX, its an open source project with contributors from both MS and the community) the control I use is the so you can see a list of the Blogs and click each to reveal the text.

To use this you will need to have ASP.NET AJAX RC1 installed.

!

Simple page layout using CSS, the right panel contains a Datalist control bound to the RssDataSource to display the blog items, the datalist control is wrapped in an asp:UpdatePanel. The item template in the datalist has a collapsiblepanelextender from the AjaxControlToolkit to display the description of the blog item.

!

Chaging the selection of Blog to view fies the asp:UpdateProgress panel to display, the blog items are loaded and displayed.  You can see on the Blog list I have simply shaded the background of the

  • element to show the active blog.

    !

    The code for this is pretty simple with all thanks going to the AjaxControlToolkit team and Dmitry for the RSS reader.

    ASPX Markup

    List of blogs on the left....

    !

    DataList Control.....

    !

    C# Code Behind

    As you can see each Link button is hooked up to an OnCommand Event Handler and the argument identifies which blog feed to bind to the data source.

    !

    ....finally on the page I have added a little bit of Javascript to change the CSS class of the blog list item to indicate which one is active.

    If ele (the

  • element) is null I assume this is the first call and so the element will be list1.

    !

    Hope you find this as useful as I did - download the full source here.

  • This article is part of the GWB Archives. Original Author: Steve Clements

    New on Geeks with Blogs

    • We Won The One Award I Actually Care About

      Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

    • Your Customers Build the Features Now

      I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

    • Get the Size of a Directory in Linux the Easy Way

      du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

    • Vim Search and Replace: The Ultimate Guide

      One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.