RSS Feed selector

B

Bo

I found an example on
http://geekswithblogs.net/evjen/archive/2004/07/23/8792.aspx but does this
work correctly for you guys?

If I select a different feed from the dropdown and then try to load the
first in the dropdown called Top News that feed is not loaded. It still
shows the previous selected instead.

Do you know what I should do to fix that error?

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">

Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs)

XmlDataSource1.DataFile = DropDownList1.SelectedValue

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Reuters News</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<span style="font-size: 10pt; font-family: Verdana">Select News
Topic:<br />

<asp:DropDownList ID="DropDownList1" Runat="server"
AutoPostBack="True"

OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/topNews">Top News</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/businessNews">Business
News</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/domesticNews">U.S.
News</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/worldNews">International
News</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/ElectionCoverage">Politics</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/Entertainment">Entertainment</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/technologyNews">Technology</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/scienceNews">Science</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/sportsNews">Sports</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/healthNews">Health</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/oddlyEnoughNews">Oddly
Enough</asp:ListItem>

<asp:ListItem
Value="http://www.microsite.reuters.com/rss/lifeAndLeisureNews">Life &amp;
Leisure</asp:ListItem>

</asp:DropDownList>

</span>

<br />

<br />

<asp:DataList ID="DataList1" Runat="server"
DataSourceID="XmlDataSource1"

BorderColor="Tan" BackColor="LightGoldenrodYellow"
BorderWidth="1px"

CellPadding="2" ForeColor="Black" Width="600px">

<ItemTemplate>

<asp:Label ID="Label1" Runat="server" Text='<%#
XPath("pubDate") %>' ForeColor="gray" Font-Bold="True"

Font-Names="Verdana"
Font-Size="XX-Small"></asp:Label><br />

<asp:HyperLink ID="HyperLink1" Runat="server" Text='<%#
XPath("title") %>' NavigateUrl='<%# XPath("link") %>'

Target="_blank" Font-Names="Verdana"
Font-Size="X-Small"></asp:HyperLink><br />

<%# XPath("description") %>

</ItemTemplate>

<AlternatingItemTemplate>

<asp:Label ID="Label3" Runat="server" Text='<%#
XPath("pubDate") %>'

ForeColor="gray" Font-Bold="True"

Font-Names="Verdana" Font-Size="XX-Small"></asp:Label><br
/>

<asp:HyperLink ID="HyperLink2" Runat="server"

Text='<%# XPath("title") %>' NavigateUrl='<%# XPath("link")
%>'

Target="_blank" Font-Names="Verdana"
Font-Size="X-Small"></asp:HyperLink><br />

<%# XPath("description") %>

</AlternatingItemTemplate>

<AlternatingItemStyle
BackColor="PaleGoldenrod"></AlternatingItemStyle>

<ItemStyle Font-Names="Verdana" Font-Size="X-Small"></ItemStyle>

</asp:DataList>

<asp:XmlDataSource ID="XmlDataSource1" Runat="server"

DataFile="http://www.microsite.reuters.com/rss/topNews"

XPath="rss/channel/item">

</asp:XmlDataSource></div>

</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top