473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

timers

I am new to asp. I tried implementing a timer in a System.Web.UI.Page
derived class to perform periodic refreshes of the interface and calls to a
web service but it does not seem to work as I expected. I could not set its
SynchronizingObject field.

When the page first loads I see that the timer has been operating for 2 or 3
seconds already (it updates the text field of a label control), but whenever
I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...

Nov 18 '05 #1
3 1407
Stephen McCrea wrote:
I am new to asp. I tried implementing a timer in a System.Web.UI.Page
derived class to perform periodic refreshes of the interface and calls to
a web service but it does not seem to work as I expected. I could not set
its SynchronizingObject field.

When the page first loads I see that the timer has been operating for 2 or
3 seconds already (it updates the text field of a label control), but
whenever I perform other refreshes of the interface it does not seem to be
working properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Hello Stephen,

It's not possible to use timers like this, at least not if you're
using the web forms framework with ASP.NET. As soon as your page
object has finished the "render" phase ( sent its output as a
response back to the client ), your page object will be destroyed.
Next request from the client, a new instance will be created again.
In this scenario, the only way to refresh the client periodically
is by using some client side JavaScript.

If you don't use the web forms framework, you can keep the response
stream open and periodically send JavaScript to the client which
contains instructions to update the user interface. In this scenario,
you do have to watch out for timeouts, f.i. there may be limits
to the amount of time a web browser will wait for a response
to finish and there may be limits to the amount of time an
aspx may run on the server. Also, I believe this doesn't
work correctly in all browsers, because some browsers
only begin executing JavaScript when they received
the complete response.

Best regards,

Eric
Nov 18 '05 #2
Server side timers aren't much good with ASP.NET pages because they only
exist long enough for the HTML to be generated and sent to the client
(usually a few milliseconds.)
Therefore you'll probably find a client side timer more useful, which
executes in the user's browser and therefore keeps going as long as the page
is open in the user's browser.

Here's an example for you:
http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Stephen McCrea" <sm*****@mccreaengineering.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I am new to asp. I tried implementing a timer in a System.Web.UI.Page
derived class to perform periodic refreshes of the interface and calls to a web service but it does not seem to work as I expected. I could not set its SynchronizingObject field.

When the page first loads I see that the timer has been operating for 2 or 3 seconds already (it updates the text field of a label control), but whenever I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Nov 18 '05 #3
Server side timers aren't much good with ASP.NET pages because they only
exist long enough for the HTML to be generated and sent to the client
(usually a few milliseconds.)
Therefore you'll probably find a client side timer more useful, which
executes in the user's browser and therefore keeps going as long as the page
is open in the user's browser.

Here's an example for you:
http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Stephen McCrea" <sm*****@mccreaengineering.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I am new to asp. I tried implementing a timer in a System.Web.UI.Page
derived class to perform periodic refreshes of the interface and calls to a web service but it does not seem to work as I expected. I could not set its SynchronizingObject field.

When the page first loads I see that the timer has been operating for 2 or 3 seconds already (it updates the text field of a label control), but whenever I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
371
by: GDumencu | last post by:
I have a C# program that have to run all the time. For some reasons I cannot make it a service. This program has 3 timers and by time to time ( days or weeks) one of them stops. Some times, starts...
0
1742
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they...
0
1733
by: Cider123 | last post by:
I was originally using: System.Windows.Forms.Timer It started to lock my Window Service up, so I went to the next evolution: System.Threading.Timer All was good. I was using it to send...
3
2179
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My...
3
2016
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a...
9
7843
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I...
10
2668
by: WhiteSocksGuy | last post by:
Help! I am new to Visual Basic .Net (version 2002) and I am trying to get a System.Timers.Timer to work for me to display a splash screen for about two seconds and then load the main form. I have...
5
9854
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated...
1
1806
by: | last post by:
Frustrated.. (I have seen other posts regarding this problem with no resolution..) I am using dotnet 1.1 with latest SP on a Win2KP box (actually 2 boxes), have even run the service on WinXP SP2...
1
3000
by: Jonathan Woods | last post by:
Hi there, I have three methods these need to execute at every interval time. I would like to know which option is better? Option A) Three System.Timers.Timer objects these execute each...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.