Use ASP. NET to create an online RSS news aggregator (2)

Source: Internet
Author: User

Use the aggregate abstract on the ASP. NET page

To test the aggregation engine we just created, we will create an online news aggregator that allows the collection of any number of aggregated content summaries. The aggregation interface is very simple. See figure 2. It consists of three framework pages. The left-side frame lists different aggregate content summaries in the form of a list. The upper right frame shows the news items contained in the selected aggregated Content summary and the links to view the news item. Finally, the selected news item title and content are displayed in the lower right frame. By the way, this interface is basically a de facto standard interface for various types of aggregators, including the news aggregators, email client software, and newsgroup readers.

Figure 2 UI of the news aggregator
The first step is to create an HTML page to create a framework user interface. Fortunately, in Visual Studio. NET 2003, this process is very easy. You only needProgramAdd a new project to the solution, and select the new project type as frameset. (I named this new file newsaggregator.htm in my project. The reason why I set it to an HTML file instead of an Asp.net page is that this page only includes the htmlCode. Each separate framework will display an Asp.net page ). Next, see Figure 3. The frameset template Wizard will start, simply select the option "nested hierarchy", and then press OK.

 
Figure 3 frameset template wizard in vs2003
Then the frameset template Wizard will create an HTML page, which has already been added to the FrameworkSource code. Set the src attribute of the framework on the left to displayfeeds. aspx, which is the URL of the Asp.net page where the aggregate summary page is displayed in the list. Now the newsaggreator.htm page is complete.

The following three sections describe how to create three online news aggregators: displayfeeds that display the aggregate summary list. aspx; displaynewsitems that displays news items of a specific aggregation abstract. aspx; and displayitem that displays the specific content of a specific news item in the specified aggregation abstract. aspx.

Show aggregate summary list

Now we need to create the displayfeeds. ASPX page. This page displays the aggregated summary list of subscriptions. As a demonstration, I put these aggregation summaries in a database table named feeds. You can also put them in an XML file. The feeds table has the following four fields:

· Feedid-primary key, auto-incrementing Integer type, uniquely identifies a abstract

· Title-Abstract name, database Field Type: varchar (50)

· URL-URL of the RSS abstract. database Field Type: varchar (150)

· Updateinterval-update frequency (minutes) of the Summary. database Field Type: int

The displayfeeds. ASPX page uses a DataGrid Control to display the list of aggregate summaries. This DataGrid has only one hyperlinkcolumn column. The title field is displayed and linked to the displaynewsitems. ASPX page. The value of the feedid field must be passed in the query string. The following is the declaration of the DataGrid control. For simplicity, some irrelevant parts are omitted ):

autogeneratecolumns = "false"...>
...

datanavigateurlfield = "feedid"
datanavigateurlformatstring = "displaynewsitems. aspx? Feedid = {0} "
datatextfield =" title "headertext =" RSS feeds ">



the key here is the definition of hyperlinkcolumn. Its target attribute is set to the name of the upper-right frame, so that when the user clicks, The displaynewsitems. ASPX page is displayed in the upper-right frame. In addition, the attributes datanavigateurlfield, datanavigateurlformatstring, and datatextfield are also set to display the abstract title in a hyperlink. When you click it, the user is taken to displaynewsitems. ASPX page, and pass the feedid field content in the query string. (The background code class on this page only accesses the abstract list from the feeds table, returns results alphabetically by the title field, and then binds the query results to the DataGrid Control. Due to space limitations, this article does not list the code here .)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.