Link to home
Start Free TrialLog in
Avatar of craigdev
craigdev

asked on

AJAX Timer1

How do you start a timer with AJAX?


I have codebehind handing the Timer.Tick event, yet this never gets called....

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Default.Master" CodeBehind="progress.aspx.vb" Inherits="UI.progress" 
    title="XXXXXXXXXX - Progress" %>
 
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyPanel" runat="server">
    <asp:UpdatePanel id="UpdatePanel1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <contenttemplate>
            <asp:Timer id="Timer1" runat="server" __designer:dtid="5066549580791809" __designer:wfdid="w10" Interval="3000" OnTick="Timer1_Tick">
            </asp:Timer>
            <BR />
            <asp:Panel id="pnlOutput" runat="server" Width="858px" Height="100%" __designer:wfdid="w9"> </asp:Panel> 
            <BR />
            <asp:Label id="lblMasterProgress" runat="server" Width="170px" Text="Progress - 0.0%"></asp:Label> 
        </contenttemplate>
    </asp:UpdatePanel>
    <asp:Button ID="btnCancelOrContinue" runat="server" Text="Abort" Width="123px" />
</asp:Content>

Open in new window

Avatar of cottsak
cottsak
Flag of Australia image

what is it you're trying to do?
Avatar of craigdev
craigdev

ASKER

refresh a progress screen every 5 seconds
the whole page (ie. you have maybe a small popup page with the progress in it)? or just part of a page and you want to use ajax to update it?
just a page and i want to use ajax to update it,

the panel, pnlOutput, has rows of a pair of labels added at: label1 in each row has the the name of the item and the label2 shows % complete for that item. The number of rows varies and so I can't add them to the page in the designer. I am storing them in the session along with an array of business objects. In the tick event I am reloading the progress count from each object in the array and refreshing the text on the second label in each row.

The problem is the Timer1.Tick event never fires. I added a refresh button which runs the same code as the Timer1_Tick function and when I click refresh it works nicely. However I can't get the Timer to tick.
ASKER CERTIFIED SOLUTION
Avatar of cottsak
cottsak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I see your point, thanks