V. Logical layer Design
(i) Add RSS Channel
Before you start the real logic layer design, let's take a quick look at the following sketch 4. Figure 4 illustrates my understanding of the proposed implementation of the client data binding architecture for two important asp.net AJAX client controls-listview and DataSource, as well as MS Ajax official data.
Figure 4:asp.net The typical client data binding architecture recommended in the AJAX framework
From the above illustration, we can conclude that, in the actual combat environment (also in this case), when adding a new RSS channel, we do not need to immediately store this data in the server-side SQL Server database. Instead, it is temporarily stored in a data source control that is associated with the client control ListView. So you can guess that the DataSource control is a batch update operation-it supports temporary storage of client-modified data and ultimately updates the server-side database in batch mode. The two important methods in the sketch above-"Save" and "Load"-play an important role in this implementation logic.
In this section, we only need to temporarily store the user's newly entered RSS channel information on the client. Here, I encountered the first challenge in manipulating the ListView control. Now let's take a look at the corresponding source code.
List 1
<script language="javascript" type="text/javascript">
var g_RSSNameList;
function pageLoad(sender, args) {
g_RSSNameList=$find('RSSNameList');
…………
}
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());
}