Geeks With Blogs


Steve Clements .Net and then some....

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 team) download the toolkit here.

I have also used the AJAX Toolkit (which if you are unaware is a collection of controls for use with AJAX, its an open source project with contributors from both MS and the community) the control I use is the Collapsible Panel control 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 <li> 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 <li> 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.

Posted on Sunday, December 17, 2006 1:52 PM AJAX | Back to top

Comments on this post: ASP.NET AJAX RC1 RSS Reader

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Steve Clements | Powered by: