AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=1372&pId=-1
Developing an ASP.NET AJAX Based RSS Reader
page
by Xianzhong Zhu
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38678/ 84

Introduction

As a popular format for syndicating news and subscribing to the contents of websites, more and more websites have been providing various kinds of RSS (acronym for Really Simple Syndication) services so as to improve the interactions between the users and the data of the websites.  In this article you learn to write a RSS reader sample application based on Microsoft ASP.NET AJAX framework.

Introduction to RSS

RSS is an XML-based format that allows the syndication of lists of hyperlinks, along with other information, or metadata, that help viewers decide whether they want to follow the link.

This allows a person's computer to fetch and understand the information, so that all of the lists that he is interested in can be tracked and personalized for him.  It is a format that is intended for use by computers on behalf of people, rather than being directly presented to them (like HTML).

To enable this, a Web site will make a feed, or channel, available, just like any other file or resource on the server.  Once a feed is available, computers can regularly fetch the file to get the most recent items on the list.  Most often, people will do this with an aggregator, a program that manages a number of lists and presents them in a single interface.

Feeds can also be used for other kinds of list-oriented information, such as syndicating the content itself (often weblogs) along with the links.  However, this tutorial focuses on the use of RSS for syndication of links.

Here is an example of a minimal RSS 2.0 feed:

Listing 1

<?xml version="1.0"?>
<rss version="2.0">
      <channel>
            <title>Example Channel</title>
            <link>http://example.com/</link>
            <description>My example channel</description>
            <item>
                  <title>News for September the Second</title>
                  <link>http://example.com/2002/09/01</link>
                  <description>other things happened today</description>
            </item>
            <item>
                  <title>News for September the First</title>
                  <link>http://example.com/2002/09/02</link>
            </item>
      </channel>
</rss>

Currently, nearly all web sites provide support for RSS 2.0.  From the above listing we can see that a RSS file is mainly composed of nodes, such as rss, channel, item, etc.  Here, node rss specifies the namespace to abide by; node channel represents one category in some blog or new group, while item corresponds to the main info for users to view, including titles, hyperlinks, pub-date, etc.  The following table lists the standard elements that constitute an RSS file.

Table 1: Elements within a RSS 2.0 channel

Element

definition

Title

The title of this channel

Link

The hyperlink of the web site for the channel to be linked to

Description

The description information for this channel

Language

(omitted)

Copyright

(omitted)

managingEditor

(omitted)

webMaster

The information of the main manager of the web site

pubDate

(omitted)

lastBuildDate

(omitted)

image

The image information within this channel

Note you can refer to this address for all the elements contained in a RSS 2.0 file.

Dmitry Robsman's ASP.NET RSS Toolkit

In this article we will seek help to the famous open source RSS toolkitRssToolkit (authored by Microsoft Dmitry Robsman, which can be downloaded from http://blogs.msdn.com/dmitryr/) to serve as an agent between this sample application and the RSS channel information because currently there are many versions available for RSS subscription, such as 0.90, 0.91, 0.92, 0.93, 0.94, 1.0 and 2.0, with various small differences between them.  Also, to directly work with the different versions, you have to exert tremendous effort.

Concretely, this toolkit supplies the following main features:

·         RssDataSource control to consume feeds in ASP.NET applications:

1) Works with ASP.NET data bound controls

2) Implements schema to generate columns at design time

3) Supports auto-generation of columns at runtime (via ICustomTypeDescriptor implementation)

·         Caching of downloaded feeds both in-memory and on-disk (persisted across process restarts)

·         Generating strongly typed classes for feeds (including strongly typed channel, items, image, handler) based on a feed URL (the toolkit recognizes RSS, Atom and RDF feeds) or a file containing a sample feed and allowing programmatically download (and creation) of feeds using strongly-typed classes.

So much for the RSS introduction!  Let us now focus on our main topic.

Requirements and Goals

Before plunging ourselves into the related details, let us summarize the main functions and the required key techniques of our sample application.

Main Functions

An online RSS Reader can store your favorite RSS subscriptions in the server-side database for a more convenient access from any Internet-connected computer later on.  In general, we can easily describe the general mechanism and rough flow chart of a typical RSS Reader application, as is shown in Figure 1.

Figure 1: The general flow chart of an online RSS Reader application

According to the above figure, our RSS reader sample project called DAjaxRssReader in this article will mainly achieve the listed goals.

·         Adding RSS channels

Users can add and save the RSS channels and the relevant URL's they entered into an ASP.NET AJAX client-side data source control.  And of course, they can persist all this information into a server-side SQL Server database.

·         Displaying all the RSS channels

This concerns two cases: 1. when the application first starts up all the channels persisted in the server side database can be listed on the browser side and 2. when the users refresh the RSS channels, all the channels-related data can also be fetched and displayed.

·         Displaying the detained information associated with a specified RSS channel

When users select some channel, the application should exhibit the corresponding contents that are usually linked to another web site.

The Key Techniques

First, in constructing a normal web application, we should try to abide by the famous Three-Tier pattern to build it.  The following illustrates the rough architecture of our sample application: a RSS reader.

Figure 2: The whole architecture of our RSS reader application

Second, before discussing the required key techniques, let us take a look at the snapshot of the sample's main page.

Figure 3: The design-time snapshot of the sample RSS reader

As seen from the above figures, we need the following techniques to construct this application:

1. In the presentation tier we need ASP.NET AJAX client-side ListView control to hold and exhibit all the RSS channels info and a server UpdatePanel control to enclose the ASP.NET AJAX Control Toolkit control Accordion to finally display the web site contents associated with the item you picked from the left-side ListView.  Also, some CSS tips are required to embellish all the related controls.  Finally, we introduce ASP.NET AJAX client-side Validators to validate the RSS names and URL's we entered.

2. In this application we have commingled the JavaScript mode with xml-script mode programming. On the one hand, in real scenarios ASP.NET AJAX based web applications are usually pretty complicated. On the other hand, the ASP.NET AJAX framework has not been fully fledged and has a long way to go, so that we cannot attain our goals merely through the xml-script declarative mode.  Although to implement certain parts the JavaScript mode seems more complex than the in xml-script way since the ASP.NET AJAX client side has provided comparatively mature xml-script model as quite resembles ASP.NET, the JavaScript mode can control nearly every side of the server and client-side controls from under the bottom.

3. As the data tier is concerned, this is a typical action in composing an ASP.NET AJAX based application, which is strongly recommended by the official documents.

Author's Notes:  In debugging the demo, I was very much puzzled by the client-server communication brought forth by introducing the ASP.NET AJAX Control Toolkit control Accordion combined with Dmitry Robsman's ASP.NET RSS Toolkit. In my opinion, we cannot (in the usual way) dynamically bind the server-side RssDataSource (a class in the RSS.NET toolkit) to the Accordion control (in fact an ASP.NET AJAX server Extender) in a web service. Thus, I have to resort to an "ugly" tip the __doPostBack function to connect the client with the server, which will obviously trigger a whole page refresh (this drastically violates the ASP.NET AJAX rules). Thus, I have to introduce the server control UpdatePanel to enclose the Accordion covered area to achieve some partially refresh effect.  Note that another factor making things complex results from the ASP.NET AJAX client-side ListView control.  I am sure that the ListView control and I are both immature for now!

Next, let us figure out how we are going to accomplish all that we have set out for ourselves.

Data Tier Design

With the above goals in mind, let us now shift our attention to the database design.

Database Design

Launch Visual Studio 2005, and then select menu item "File | New Website…" to create a new website using the template named "ASP.NET AJAX-Enabled Web Site." Name the project AjaxRss (select Visual C# as the built-in language). After that, the system should automatically add references to the necessary assemblies: Microsoft.Web.Preview.dll and System.Web.Extensions.dll.  You can see a ScriptManager server control (the headquarters of whole ASP.NET AJAX framework) automatically added to the page.

Now, right click the project, select "Add new Item…" and then choose the template "SQL Database" to create a database named RssReader.mdf.  In this application we add to it only one table named RssStore (whose fields are detailed in the following table).  After that we are also to create four simple stored procedures, DeleteRecord, GetAllRecords, InsertRecord, UpdateRecord, which are associated with the typical CRUD database operations.  We will not dwell much on these since our main interests do not lie here.

Table 2. Structure for table RssStore.

Field name

Type

Notes

Rss_ID

int

Primary Key

Rss_Name

nchar(32)

The RSS channel name

Rss_URL

nchar(64)

The RSS channel URI (or URL)

Web Service Design

Next, we will write a web service to be consumed from the browser side in ASP.NET AJAX way.  In this sample we let the service return an array of object RssInfo (serving as the OOP wrapper for the record in the database table RssStore).

Right click the project, choose "Add new item" and create a new Web Service named MyDataService.asmx.  Next, we are to open file BookDataService.cs and add all our required WebMethods: DeleteRecord, GetAllRecords, InsertRecord, and UpdateRecord, all of which are quite similar to those in my previous article published at aspalliance.com. Thus, we choose to omit the analysis with them.  For the associated details, please refer to that article and download the source code at this end of this article.

Next, comes the user interface design phase.

User Interface Design

According to the general architecture introduced above, we can divide the whole user interface into three parts.

1. Add a new RSS channel info (including the name and its related URI).

2. Exhibit the RSS channel lists.

3. Display the contents (from the associated web site URL) of the specified channel.

The above-depicted figure shows the design-time user interface of the application.

As is seen from Figure 3, the upper left is an ASP.NET AJAX client-side controlListView which is used to hold and show the RSS channel list. The .gif animation (in relation to the emptyTemplate template of ListView control) below it is just for creating a friendlier user experience. The larger rectangle area (that contains several simple ASP.NET AJAX client-side controls) below the animation is a HTML div tag (named "buttonarea") which is used for the user to enter new interesting RSS channel info.  The right part of the whole page lies in the ASP.NET AJAX Control Toolkit Accordion which is introduced to display the detailed information of the specified RSS channel. 

As for the several mysterious litter dots in the div "buttonarea" and the server control UpdatePanel that encloses Accordion and its related UpdateProgress control, you can find out the related answers later on.  Now, you are sure to have noticed the Rss Toolkit control RssDataSource at the far lower left corner.  It is designed to provide data source to Accordion from the server side. In general, we can only use it at run-time from the server side since it is a server-side data source control. There exist some puzzles with it; we are also to discuss them later. Finally, all the controls we have just introduced are arranged as sub elements through a HTML table element.

Now with the data tier and presentation tier in mind, let us turn our attention to the next period of the development the logic tier design.

Adding the RSS Channels

Before delving into the topic, let us first take a glimpse at the following sketch in Figure 4, which illustrates my comprehension concerning the two ASP.NET AJAX client-side controls, ListView and DataSource, and MS AJAX official suggestion in implementing the client-side data binding architecture.

Figure 4: The typical client-side data binding paradigm introduced in ASP.NET AJAX

From the above figure we can conclude that in real scenarios (just as with this sample) when adding a new RSS channel we do not need to persist the info into the server-side SQL Server database immediately but to temporarily store it into the client-side DataSource control associated with the client-side ListView control. Therefore, just as you may have guessed, the DataSource control support batch update which enables the temporary store for the client-side modification and submission to the server side in batch update mode.  Here the two methods "Save" and "Load" in the above sketch play the important role in achieving the above logic.

Thus, in this part we only need to temporarily save the newly-entered RSS channel info in the client side. Here I met my first obstacle in dealing with the ListView control.  Let us first see the related source code as shown in Listing 2.

Listing 2

<script language="javascript" type="text/javascript">
var g_RSSNameList;
function pageLoad(sender, args) {
      g_RSSNameList=$find('RSSNameList');

          ……(omitted)

}

function Add_onclick() {
      g_RSSNameList.addItem();
      var  index=datatable.get_length()-1;
      datatable.getItem(index).setProperty('Rss_ID', index);
      datatable.getItem(index).setProperty('Rss_Name', 
        $find('txtRssName').get_text());
      datatable.getItem(index).setProperty('Rss_URL', 
        $find('txtRssUrl').get_text());
}

When the user clicks the client-side HTML Input button "Add the RSS Info," the above JavaScript function Add_onclick (the click event handler) is invoked.  Here, g_RSSNameList is a global JavaScript variable to refer to the ListView control "RSSNameList" (which is used to hold and display the RSS channel info).  First, we call method addItem of ListView, which is able to add an empty record at the end of the DataTable control associated with the DataSource control and, at the same time, make the data set dirty (this is rather important for the "Save" operation). Next, we get the record number of the empty record we have just inserted. Then we call method getItem (same as method getRow) to fetch the empty record and invoke method setProperty to populate the corresponding table field. One important thing to remember is that we must use the client-side global method $find instead of using $get; or else you are sure to meet some trouble.  Please refer to the online materials for the differences between the two methods. At last we have succeeded in inserting (i.e. appending) a record into the client-side data source.

Here, an episode should be mentioned.  In composing the "buttonarea" div element, we should try our best to use the "pure" client-side HTML elements to achieve a better "AJAX" effect. Here I utilize the client-side Validator component, the simplest requiredFieldValidator to prevent the user from leaving the related text box controls empty.  The following is the related xml-script code.

Listing 3

<textBox id="txtRssName">
      <validators>
            <requiredFieldValidator errorMessage="You must name the RSS!" />
      </validators>
</textBox>
<validationErrorLabel id="validator1" associatedControl="txtRssName" />
 
<textBox id="txtRssUrl">
      <validators>
            <requiredFieldValidator errorMessage="Please name the RSS URL!" />
      </validators>
</textBox>
<validationErrorLabel id="validator2" associatedControl="txtRssUrl" />

Here, in the second textbox validating, you can use the better regular expression validator regExValidator to attain a more applicable effect (because I am not quite sure of the most universal regular expression for invalidating a URL, sorry for not having given the proper answer).  When you leave the textbox controls empty (such as just entering some blank characters), there will appear a red star to prompt you to enter something.  In debugging the sample, when I leave the controls empty without inputting any characters, there appears no response!  Does it sound peculiar or is there some bug with this Validator control?

Author's Notes: In this demo application, I have not achieved the "delete" and "modify" functions. If you are a brave man, then I highly suggest you to add these additional functions.  And if this indeed comes true, you will have mastered the ASP.NET AJAX client-side programming.

Next, let us discuss how to display the RSS channels that we have just persisted in the server-side SQL Server database.

Displaying the RSS Channels

In this section of the RSS reader application there are at least two cases in connection with displaying the RSS channels.

1. When the page is first loaded all the RSS channels stored in the server-side SQL Server database should be displayed in the ListView control mentioned above.

2. When the user clicks the "Refresh" button all the original RSS channels' info in the server-side database should also be shown.

Examine the first case. The following Listing shows all the related xml-script code.

Listing 4

<script type="text/xml-script">
<span lang=FR><page xmlns:script="http://schemas.microsoft.com/xml-script/2005"></span>
      <components>
            <dataSource id="RSSInfoDataSource" serviceURL="MyDataService.asmx" >
            </dataSource>
 
            <button id="Save">
                  <click>
                        <invokeMethodAction target="RSSInfoDataSource"
                            method="save" />
                  </click>
                  <bindings>
                        <binding dataContext="RSSInfoDataSource"
                            dataPath="isDirtyAndReady" property="element" 
                            propertyKey="disabled" transform="Invert" />
                  </bindings>
            </button>
            <button id="Refresh">
                  <click>
                        <invokeMethodAction target="RSSInfoDataSource"
                            method="load" />
                  </click>
                  <bindings>
                        <binding dataContext="RSSInfoDataSource"
                            dataPath="isReady"  property="element"
                            propertyKey="disabled" transform="Invert" />
                  </bindings>
            </button>
 
            <application>
                  <load>
                        <invokeMethodAction target="RSSInfoDataSource"
                            method="load"/>
                  </load>
            </application>
      </components>
</page>
</script>

Specify the DataSource control named "RSSInfoDataSource" which is asynchronously bound to the server-side DataService "MyDataService" through ASP.NET AJAX framework. Second, in the last <application> section when the application is started its event load is fired. Subsequently, in the sub section <invokeMethodAction> the load method of DataSource "RSSInfoDataSource" is invoked, which will trigger an asynchronous post back calling the WebMethod GetAllRecords of DataService "MyDataService." The following Listing shows the source code for this method.

Listing 5

[WebMethod]
[DataObjectMethod(DataObjectMethodType.Select)]
public List<RssInfo> GetAllRecords()
{
      return new SqlTaskProvider().GetAllRecords();
}

For a detailed explanation of the attributes decorating the method and this method, please refer to my previous article published on aspalliance.com.  As soon as this method returns the client-side ListView control, "RSSNameList" is populated with the record data persisted in SQL Server database table "RssStore."

There is a little skill herein deserved to be further researched. To gain a better user experience we select to hide the unnecessary fields (Rss_ID and Rss_URL).  The following gives the related HTML code snippet.

Listing 6

<div id="searchResults_itemTemplate" >
      <span id="searchResults_Rss_ID" 
          style="display: none; visibility: hidden;"></span>
      <span id="searchResults_Rss_Name"></span>
      <span id="searchResults_Rss_URL" 
          style="display: none; visibility: hidden;"></span>
</div>

No worries. The framework will automatically discern this situation and still populate the ListView control with the database record data as usual, with only the two specified fields being hidden.  That is it!

Now, let us examine the second case when the user clicks the Refresh button.  Although literally we use the word "Refresh," the real purpose is to load the original data in the server-side database into the current ListView.  We should own this function to method load of the client-side DataSource control. The following xml-script code indicates to you the associated programming.

Listing 7

<button id="Refresh">
      <click>
            <invokeMethodAction target="RSSInfoDataSource" method="load" />
      </click>
      <bindings>
            <binding dataContext="RSSInfoDataSource" dataPath="isReady"
                property="element" propertyKey="disabled" transform="Invert" />
      </bindings>
</button>

As is easily seen, when the users click Refresh, method load of the client-side DataSource control "RSSInfoDataSource" is invoked. Next, you may have guessed the following things happen; the WebMethod GetAllRecords is asynchronously invoked and then the returned data is filled into the ListView control.

For integrity, in this sample application we have also introduced a Save button whose function is just contrary to that of the Refresh button. When the user clicks the Save, all the newest RSS channel data in the ListView control is persisted back into the server-side SQL Server database in AJAX way.  Again, we are not going to discuss it since my previous article brought a thorough examination with it.

Displaying the Contents of a RSS Channel

Things for now become more and more interesting. Oh, to display the contents of a RSS channel you just need to click one item in the ListView and let the right-side Accordion control exhibit the related details.  This is quite right from the user's point of view, but I, as a programmer, spent plenty of time tackling this problem and my solution is sure to wait to be improved by many ASP.NET Ajax gurus. Let me introduce my ugly solution to you.

Getting the Contents of a Channel over the Network

1. Something about the ListView control

As far as the ASP.NET AJAX client-side "advanced" ListView control is further examined, we can see it is far from mature.  By researching into the source file PreviewScript.js that is shipped with ASP.NET AJAX CTP version, we find that there are not abundant properties, methods, and events in its descriptor block (note: only things within this block can be used via xml-script mode) for us to use in the declarative xml-script programming to control ListView. The following Listing gives this block's definition.

Listing 8

Sys.Preview.UI.Data.ListView.descriptor = {
      properties: [ { name: 'alternatingItemCssClass', type: String },
            { name: 'layoutTemplate', type: Sys.Preview.UI.ITemplate },
            { name: 'itemCssClass', type: String },
            { name: 'itemTemplate', type: Sys.Preview.UI.ITemplate },
            { name: 'itemTemplateParentElementId', type: String },
            { name: 'selectedItemCssClass', type: String },
            { name: 'separatorCssClass', type: String },
            { name: 'separatorTemplate', type: Sys.Preview.UI.ITemplate },
            { name: 'emptyTemplate', type: Sys.Preview.UI.ITemplate } ],
      events: [ {name: 'renderComplete'} ]
}

Only several properties and one event are provided. As for methods to use, we have to resort to those of its parent class DataControl (merely in support of a few methods).  Therefore, to control the item (i.e. record) click event, we have to further research into its prototype block and fall back on the blasted JavaScript programming.

2. Adding click event to ListView via JavaScript

Let us list all the source code associated with the above target.

Listing 9

<script language="javascript" type="text/javascript">
var g_RSSNameList;
function pageLoad(sender, args) {
      g_RSSNameList=$find('RSSNameList');
      $addHandler($get('RSSNameList'), 'click', clickRowHandler);
 
}
function clickRowHandler(ev)
{
      var s = ev.target;
      while (s && (typeof(s.dataIndex) === 'undefined')) {
            s = s.parentNode;
      }
      if (s) {
            var idx = s.dataIndex;
            //call the server-side method in relation to Server side 
            //dummy Button 'dummySrvBtn'
            <span lang=PT>var btn ='<%=dummySrvBtn.ClientID%>';</span>
            <span lang=PT>var txt='<%=txtRssUrl2.ClientID%>';</span>
            <span lang=PT>document.getElementById(txt).value=s.lastChild.innerText; </span>
            __doPostBack(btn,'');
      }
}
......(omitted)
function pageUnload() {
      //dispose the event handler
      if (clickRowHandler)
      $removeHandler($get('RSSNameList'), "click",clickRowHandler);
      clickRowHandler=null;
}

Here, we first use the global method $addHandler to attach the event handler clickRowHandler to the "click" event of ListView RSSNameList. Next, we start the event handler programming.  At the very beginning the property ev.target is pointing to ListView RSSNameList. When the control flows to the if conditional sentence the variable s points to searchResults_itemTemplate (where the database record lies). OK, for now we can get the current value of the record index using variable idx and get any field (we are only interested in field Rss_URL which corresponds to the last field) value we want to fetch.

Things now become more complex; how can we dynamically assign the current RSS url to RssDataSource, the third-party server-side data source control?  My ugly solution to this is to resort to the method "__doPostBack."  According to my analysis, we cannot dynamically bind RssDataSource to Acccordion in some Web Service method. Thus, we have to seek anywhere else the CodeFile AjaxRssReader.aspx.cs. In this behind code we can achieve our goal to dynamically bind RssDataSource to Acccordion (note we cannot do this in the client-side JavaScript mode since RssDataSource is a server-side data source control).  This is why we find __doPostBack through which we can indirectly communicate the client-side controls with the server-side controls (where we can succeed in the dynamic binding).

OK, now we first create two dummy ASP.NET controls (you can certainly find your own way): a Button and a TextBox control. Since they should be "invisible" at run-time we set their sized to the smallest (1px X 1px) and accordingly set the background colors to LightGray (the background color of the "buttonarea" panel).

Author's Note:  You cannot directly set the property Visible of the two dummy controls to "false" or else you are sure to meet some run-time trouble. Just try it!

Next, by calling method "__doPostBack" above we indirectly call the server-side click event handler, dummySrvBtn_Click(object sender, EventArgs e), that is located inside the CodeFile AjaxRssReader.aspx.cs.  Here is the related source code for this function.

Listing 10

protected void dummySrvBtn_Click(object sender, EventArgs e)
{
      RssDataSource1.Url = txtRssUrl2.Text.Trim();
      Accordion1.DataSourceID = "RssDataSource1";
      Accordion1.DataBind();
}

For now, we do not dwell on this code but leave this in the next section.

By assigning the value of field Rss_URL to the attribute value (in relation to the server-side property Text) of the related HTML Input element txtRssUrl2.ClientID (in corresponding to the ASP.NET server-side IdtxtRssUrl2), we can succeed in transfering the data from the client side to the server side!

Finally, calling method "__doPostBack" will certainly trigger a whole page refresh, which is quite contrary to the original AJAX idea. This is why we have to introduce the ASP.NET AJAX server control UpdatePanel which is used to enclose the Accordion control. Note that we use the trigger AsyncPostBackTrigger to let the click event of button '"ummySrvBtn" to trigger the UpdatePanel.  Here is the related HTML code.

Listing 11

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <Triggers>
            <asp:AsyncPostBackTrigger ControlID="dummySrvBtn" EventName="Click" />
      </Triggers>
      <ContentTemplate>
            <ajaxToolkit:Accordion ID="Accordion1" 
                CssClass="myAccordion" HeaderCssClass="header"
……(omitted)

And by the way, we add an UpdateProgress control to gain a better user experience.

Is the above an ugly solution?  I sincerely expect zealous readers to improve this and also welcome them to email me.

Displaying the Content

As for displaying the clicked item-related RSS contents, it is pretty easy for now. In fact, we have accomplished this task from the above listing. By dynamically assigning a value to property Url of control "RssDataSource1," binding it to control "Accordion1" and invoking method DataBind of "Accordion1," we can display the related RSS channel content that corresponds to the user clicked channel.

Author's Notes: First, by looking through the web I could not find the proper samples to dynamically assign data to control RssDataSource. Second, I have commented out the field author from inside the <ContentTemplate> block of control Accordion since there might exist RSS contents that do not contain this field. Because I am a newbie to the Rss Toolkit and control Accordion, I cannot find the more alternate solution for the programmer to dynamically control the displayable field of the RSS channel within the control Accordion. For all these reasons I had to make the test again and again and finally found the above ugly solution. So, it is just for your reference.

Let us take a look at our final fruit, as illustrated in the following figure.

Figure 5: The run-time snapshot of the sample after the user has clicked item "Scott Guthrie"

Downloads
Summary

In this article we have developed a simple RSS reader application using ASP.NET AJAX framework. As just a demo, the application still has the following points to be improved or added:

·         Programming only using the ASP.NET AJAX client side approach

·         Finding new ways of communicating the client side with the server side

·         Using the client-side control XSLTView instead of the server control Accordion to display the RSS channel contents

·         Using the client-side Validator regExValidator to validate the RSS channel address

·         Enabling the user to delete/modify the RSS channel info at run-time

·         Adding other types of RSS and letting the users classify the contents

Happy ajaxifying your web applications!



©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-23 10:53:37 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search