Simple clock on a aspx page?

  • Thread starter Thread starter Tmuld
  • Start date Start date
T

Tmuld

Hello,

I just need to create a simple clock.

I was going to have a plain page with a lable on it. Then point that
label to the time:

label1.Text = DateTime.Now.ToLongTimeString

but that will make it display the current time - how do I get it to
update the time without having to hit page refresh?

I noticed a Timer component, but have now idea how to use it.

Help?

Tmuld.
 
Thanks!

Unfortunately I am using VS 2003.

Anyone have a realtime simple clock code example for vb .net?

Thanks,
 
Tmuld said:
Hello,

I just need to create a simple clock.

I was going to have a plain page with a lable on it. Then point that
label to the time:

label1.Text = DateTime.Now.ToLongTimeString

but that will make it display the current time - how do I get it to
update the time without having to hit page refresh?

I noticed a Timer component, but have now idea how to use it.

Help?

Tmuld.

I would dare to say that a simple clock would best be accomplished with
client-side script (Javascript).
The user's browser can handle an update every second with no problem.
here's one result of a google search
http://www.jsmadeeasy.com/javascripts/Clocks And Date/list_test.asp
 
I did try one. Unfortunately this javascript is sitting in IIS and
being called to Portal (as a web service) - the HTLM shows up - but no
time - just a blank. But no errors.

It works fine right off the machine it it running on.

....

No way to make a simple vb.net aspx clock that automatically updates
to a Label?

Thanks,

Tmuld.
 
Tmuld said:
I did try one. Unfortunately this javascript is sitting in IIS and
being called to Portal (as a web service) - the HTLM shows up - but no
time - just a blank. But no errors.

It works fine right off the machine it it running on.
No way to make a simple vb.net aspx clock that automatically updates
to a Label?
its possible, but its not practical.
you don't want to make a trip back to the server every second..
If you want a clock on your web page, Javascript is the way to go. (or a
java applet)
If that example does not work, then google for another, and use "javascript
clock" as the search text.
If you can't find an asp(x) example, its for good reason - its not
practical.
 
Back
Top