By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,903 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,903 IT Pros & Developers. It's quick & easy.

Creating timers

P: n/a
Hello,

I'm trying to create a timer but it doesn't appear to run.

I've tried adding one to the aspx form and coding one manually, but the
Elapsed event doesn't fire.

Any ideas?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
How is the timer declared ? An ASP.NET page just lives the time of the
browser request giving no chance to handle this from an ASP.NET page. You'll
have to use instead a variable whose lifetime is not limited to the ASP.NET
page...

You could also explain why you do this for perhaps possible alternatives ?

Patrice
"Simon Jefferies" <si****@headfirst.co.uk> a écrit dans le message de
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello,

I'm trying to create a timer but it doesn't appear to run.

I've tried adding one to the aspx form and coding one manually, but the
Elapsed event doesn't fire.

Any ideas?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-

Nov 18 '05 #2

P: n/a
Thanks for your reply,

I've added a timer to the ASP .NET page, like a control.

What I'm trying to do is create a label that displays the current time? Is
there a better way of achieving this?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-
"Patrice" <no****@nowhere.com> wrote in message
news:O%***************@TK2MSFTNGP11.phx.gbl...
How is the timer declared ? An ASP.NET page just lives the time of the
browser request giving no chance to handle this from an ASP.NET page.
You'll
have to use instead a variable whose lifetime is not limited to the
ASP.NET
page...

You could also explain why you do this for perhaps possible alternatives ?

Patrice
"Simon Jefferies" <si****@headfirst.co.uk> a écrit dans le message de
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello,

I'm trying to create a timer but it doesn't appear to run.

I've tried adding one to the aspx form and coding one manually, but the
Elapsed event doesn't fire.

Any ideas?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-


Nov 18 '05 #3

P: n/a
A timer is not for getting the current datetime. It is to raise an event
after a given elapsed time (which is not possible in an ASP.NET page that is
disposed once executed).
Just feed your textbox with System.DateTime.Now (note also this is server
side time i.e not necessarily the current local time for the user).

If you want to display and update continously the datetime you'll have
anyway to do that client side using JavaScript (having the server refreshing
the page would be really too inconvenient as it would likely came accross
what the user does and it would be a bad usage of the server resources).
Note also that the time is moft often displayed in Windows...

Patrice
"Simon Jefferies" <si****@headfirst.co.uk> a écrit dans le message de
news:e4**************@tk2msftngp13.phx.gbl...
Thanks for your reply,

I've added a timer to the ASP .NET page, like a control.

What I'm trying to do is create a label that displays the current time? Is
there a better way of achieving this?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-
"Patrice" <no****@nowhere.com> wrote in message
news:O%***************@TK2MSFTNGP11.phx.gbl...
How is the timer declared ? An ASP.NET page just lives the time of the
browser request giving no chance to handle this from an ASP.NET page.
You'll
have to use instead a variable whose lifetime is not limited to the
ASP.NET
page...

You could also explain why you do this for perhaps possible alternatives ?
Patrice
"Simon Jefferies" <si****@headfirst.co.uk> a écrit dans le message de
news:ed**************@TK2MSFTNGP10.phx.gbl...
Hello,

I'm trying to create a timer but it doesn't appear to run.

I've tried adding one to the aspx form and coding one manually, but the
Elapsed event doesn't fire.

Any ideas?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.callofcthulhu.com www.deadlandsgame.com
-



Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.