B
Bo
Hope somebody can help me.
I show some remote rss feeds on my page with this code. But if the remote
server is down how do prevent my page from getting an error? In short how do
I add some code so it gives up trying to load the remote rss feed if it's
not online?
In the code behind.....
Protected Sub Genres_SelectedIndexChanged(ByVal sender As Object, ByVal e As
EventArgs)
UpdateGenre()
End Sub
Private Sub UpdateGenre()
GenreSource.DataFile = Genres.SelectedValue
GenreNews.DataBind()
System.Threading.Thread.Sleep(2000)
End Sub
Protected Sub UpdateNews(ByVal sender As Object, ByVal e As EventArgs)
UpdateGenre()
'GenrePanel.Update();
End Sub
on the aspx page....
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/DummyScript.js" />
</Scripts>
</asp:ScriptManagerProxy><asp:UpdatePanel ID="GenrePanel" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<aspropDownList ID="Genres" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="Genres_SelectedIndexChanged"
CssClass="mytext">
<asp:ListItem Text="Link"
Value="http://www.whatever.com/rss" Selected="true" />
</aspropDownList>
<asp:UpdateProgress ID="UpdatingNews" runat="server"
AssociatedUpdatePanelID="GenrePanel" >
<ProgressTemplate>
<img src="pics/indicator.gif" alt="" /> Getting
....
</ProgressTemplate>
</asp:UpdateProgress>
<br /><br />
<asp:Repeater ID="GenreNews" runat="server"
DataSourceID="GenreSource" >
<ItemTemplate>
<div class="mytext">
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl='<%#XPath("link") %>' Text='<%#XPath("title") %>'
Target="_blank" Font-Bold="true" />
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
<asp:XmlDataSource runat="server"
DataFile="http://www.whatever.com/rss" ID="GenreSource"
XPath="/rss/channel/item [position()<=5]">
</asp:XmlDataSource>
I show some remote rss feeds on my page with this code. But if the remote
server is down how do prevent my page from getting an error? In short how do
I add some code so it gives up trying to load the remote rss feed if it's
not online?
In the code behind.....
Protected Sub Genres_SelectedIndexChanged(ByVal sender As Object, ByVal e As
EventArgs)
UpdateGenre()
End Sub
Private Sub UpdateGenre()
GenreSource.DataFile = Genres.SelectedValue
GenreNews.DataBind()
System.Threading.Thread.Sleep(2000)
End Sub
Protected Sub UpdateNews(ByVal sender As Object, ByVal e As EventArgs)
UpdateGenre()
'GenrePanel.Update();
End Sub
on the aspx page....
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/DummyScript.js" />
</Scripts>
</asp:ScriptManagerProxy><asp:UpdatePanel ID="GenrePanel" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<aspropDownList ID="Genres" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="Genres_SelectedIndexChanged"
CssClass="mytext">
<asp:ListItem Text="Link"
Value="http://www.whatever.com/rss" Selected="true" />
</aspropDownList>
<asp:UpdateProgress ID="UpdatingNews" runat="server"
AssociatedUpdatePanelID="GenrePanel" >
<ProgressTemplate>
<img src="pics/indicator.gif" alt="" /> Getting
....
</ProgressTemplate>
</asp:UpdateProgress>
<br /><br />
<asp:Repeater ID="GenreNews" runat="server"
DataSourceID="GenreSource" >
<ItemTemplate>
<div class="mytext">
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl='<%#XPath("link") %>' Text='<%#XPath("title") %>'
Target="_blank" Font-Bold="true" />
</div>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
<asp:XmlDataSource runat="server"
DataFile="http://www.whatever.com/rss" ID="GenreSource"
XPath="/rss/channel/item [position()<=5]">
</asp:XmlDataSource>