Simple clock on a aspx page?

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.
 
T

Tmuld

Thanks!

Unfortunately I am using VS 2003.

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

Thanks,
 
H

Hal Rosser

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
 
T

Tmuld

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.
 
H

Hal Rosser

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

aspx hanging ? 4
invalid time - clock adjusted forward 19
Adding a clock to a form 2
[HELP]CLOCK TIMER USING ECXEL 0
Use of a timer in a aspx page 1
Clock ! 1
Countdown/pause/resume timer 3
A negative display watch 9

Top