The following is a formal introduction to how to use the Repeater control to develop RssFeed. Very simple, four steps in total.
The first step is to design the database. For simplicity, I use Access, build a library called RssFeed.mdb, and then create a table called RssItems. This table is used to store the second-level structure of Rss, that is, the content in item, for example, as follows:
The second step is to add an xml file and give it a name Rss.xml.
The third step is to take care of the front desk:
Add a web page called RssTool.aspx, then drag a Repeater control on it, change the ID to RptRss, switch to the source view to add binding representation to the Repeater control, and delete some Html codes automatically generated by the page, so that it becomes the following It looks like this:
See RssTool.aspx.
After modification, VS will report a lot of warnings, ignore them, we have to do this, this is the effect we want!
The fourth step is to write code:
Write three methods in the RssTool.aspx.cs file. The entire code is as follows:
See RssTool.aspx.cs
Step 5: Run!
In order for your RssFeed to provide more information, such as pubDate, author or even image, you only need to bind more items in the Repeater, provided that you must provide such fields in the data table.
Expand