Login  
Search All Forums
Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
AuthorForum: PowerWEB LiveControls for ASP.NET
Topic: LiveTimer and LiveLabel Update
NaineshUK

From: London, United Kingdom
Posts: 3
Member Since: 07/13/06
posted July 27, 2006 7:40 AM

Hi there guys

I have come across an issue that i have not been able to solve

I have a livetimer running on a page, and when the timer runs down to a certain point i execute a number of functions. At this point i have a loop that pauses the page for 10 seconds and also execute a number of functions. For some reason i cannot seem to update the livelabel that i have in the page.

Here is the code

Protected Sub LiveTimer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LiveTimer1.Tick

If TimeLeft.Ticks > 0 Then
'Keep the timer running
  Me.lblTimeValue.Text = "Time remaining is " & GetRemainingTime(EndTime).ToLongTimeString

'Start the timer
  LiveTimer1.Start()
Else
  Me.lblTimeValue.Text = "We have run out of time"

'Now we want to show the current status for 10 seconds
'We need to loop for so many seconds till the time is up
Dim TimeEnd As New TimeSpan(Date.Now.AddSeconds(10).Ticks)
  Do While Date.Now.Ticks < TimeEnd.Ticks
'keep looping
  Loop

LiveTimer1.BufferedScript.Write("window.location='default.aspx';")
End If

End Sub

What i require is that the livelabel update before we get into the 10s loop.

Your help here would be much appreciated
Jeff Cranford



From: Rome, NY USA
Posts: 586
Member Since: 05/30/01
posted July 28, 2006 12:47 PM

That's not possible using Ajax techniques (at this time). In order to update a client-side element, you need a callback, then a response to the callback. What you are attempting to do is theoretically possible in the HTTP protocol (using something similar to the Response.Buffer/Response.Flush techniques from old ASP) but not supported at this time by any XmlHttp object (which is responsible for the HTTP communication to/from the browser)

I would recommend you use a countdown animated gif (you could use a LiveImage...I found an example at http://www.geocities.com/SoHo/1085/countdown.gif ). Then modify your if-statement like so:

If TimeLeft.Ticks > 0 Then
'Keep the timer running
 Me.lblTimeValue.Text = "Time remaining is " & GetRemainingTime(EndTime).ToLongTimeString

'Start the timer
 LiveTimer1.Start()
Else
 Me.lblTimeValue.Text = "We have run out of time"

' Load countdown animated gif
Me.LiveImage1.ImageUrl = "countdown.gif"

LiveTimer1.BufferedScript.Write("window.location='default.aspx';")
End If
NaineshUK

From: London, United Kingdom
Posts: 3
Member Since: 07/13/06
posted July 31, 2006 7:30 AM

Hi there, thanks for that suggestion, i got the desired results by setting a boolean value (in the if statement) and then writing out to the screen on the next callback.
Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX