This project has moved. For the latest updates, please go here.

How-to update RssDataSource with ASP.NET AJAX ?

Topics: User Forum
Feb 21, 2007 at 2:12 PM
Hi,

I am looking for a methode to update every x seconds the rss feed without postback. I want to use ASP.NET AJAX to do so. I can't get the content of the feed to change. It seems that I need to 'reload' (or something load that!) the RssDataSource. Is it how it should be done? How can I do so? ...
Here is a code (simplified) I created that illustrate the problem:
----------------------------------------------------
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>

<asp:UpdatePanel ID="UpdatePanelRss" runat="server">
<ContentTemplate>
Last update: <%=DateTime.Now.ToLongTimeString()%> THIS THING WORKS AND GETS UPDATED

<asp:DataList ID="DataList" runat="server" DataSourceID="RssDataSource" >
<ItemTemplate> NOTHING IN THE ITEMTEMPLATE WILL GET UPDATED EXCEPT FOR THE TIME
<asp:Panel ID="PanelRss" runat="server" >
<asp:Panel ID="PanelRssHeader" runat="server" >
TIME: <%=DateTime.Now.ToLongTimeString()%>
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' /><br />
</asp:Panel>

<asp:Panel ID="PanelRssContent" runat="server" >
<asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %' /><br />
</asp:Panel>
</asp:Panel>
</ItemTemplate>

</asp:DataList>
<cc3:RssDataSource ID="RssDataSource" runat="server" MaxItems="6" Url="http://www.rssfeed.xml" >
</cc3:RssDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerRss" EventName="Tick" /> THE UPDATEPANEL ONLY WILL BE UPDATED EVERYTIME THE TRIGGER IS FIRED
</Triggers>
</asp:UpdatePanel>

<asp:Timer ID="TimerRss" runat="server" Interval="3000" ></asp:Timer> REFRESH THE UPDATEPANEL EVERY 3 SECONDS
Nov 5, 2007 at 2:19 AM
Is it possible to retrive RSS feeds using Ajax Timer and Update Panel? This would be so cool. Did anybody did it? Please post the code.
Mar 26, 2009 at 1:32 PM
Keep in mind, UpdatePanel is functionally not effectine, as what we all except. The updatepanel performs a full page postback when using UpdatePanel. I think you've to write raw Ajax codes for updation.
Thanks.