|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionRSS-Feeds are great to stay informed about recent changes in your favorite websites. But it is quiet hard to read the XML documents for humans. So, I will show how you can bind RSS feeds (for example, the newest articles on CodeProject) to a The GridViewFirst, create a new aspx file and drop a <body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<a href=<%# Eval("link") %>
target=_blank><%# Eval("title") %></a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="description"
HeaderText="Description" />
</Columns>
</asp:GridView>
</form>
</body>
Now, you can copy the code for the The code behindImport the namespace
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
BindGrid("http://www.codeproject.com/" & _
"webservices/articlerss.aspx", _
GridView1, 3)
BindGrid("http://aspalliance.com/rss.aspx", _
GridView2, 2)
End Sub
Sub BindGrid(ByVal strRss As String, ByVal oGrid _
As GridView, ByVal iTable As Integer)
Dim oDs As New DataSet
oDs.ReadXml(strRss)
oGrid.DataSource = oDs.Tables(iTable)
oGrid.DataBind()
End Sub
End Class
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||