Creating timers

  • Thread starter Thread starter Simon Jefferies
  • Start date Start date
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
 
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
 
Back
Top