|
-
Nov 25th, 2009, 12:30 PM
#1
[RESOLVED] Server Clock JS
Hey guys,
Does anyone know of good JS function to display the server clock to the user?
i need it to display the clock dynamically, i tried to use ASP.NET + AJAX but after few hours the browser crash with C++ error (memory leak?)
Regards!
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 12:51 PM
#2
Re: Server Clock JS
Hey,
Can you show the code that you were using? Might be that we could get it working.
Gary
-
Nov 25th, 2009, 02:47 PM
#3
Re: Server Clock JS
i just added label and timer to updatepanel and used the tick event to update the time every second..
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 02:50 PM
#4
Re: Server Clock JS
Hey,
But, depending on exactly how you have implemented this, over a period of time, this could lead to problems with incorrectly disposed of items.
Gary
-
Nov 25th, 2009, 03:00 PM
#5
Re: Server Clock JS
the only code that i added to the Tick event was
Code:
Label1.Text = DateTime.Now
should i dispose it somehow?
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 03:02 PM
#6
Re: Server Clock JS
That's a terrible way to show a clock. You're consuming server resources for no good reason! 
You should use any existing Javascript clock script but modify it to start at a time that you specify. You can do this by generating the Javascript's startup bit from the codebehind and concatenating the server's current time. When the page loads, the javascript can use its own timer functions to increment the time on the page, but the point is that you only 'write' the time to the page once.
-
Nov 25th, 2009, 03:08 PM
#7
Re: Server Clock JS
Seems like there are lots of example of doing this over the interweb though...
Here is just one:
http://basgun.wordpress.com/2008/02/...x-updatepanel/
Gary
-
Nov 25th, 2009, 03:17 PM
#8
Re: Server Clock JS
the only difference from what i did is that the author used JS timer and i used the timer from the toolbox (which is also JS timer i guess), so what do i need to understand from this fact? the toolbox timer has memory leak??
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 03:19 PM
#9
Re: Server Clock JS
Hey,
No, I certainly don't think that there is a memory leaker in the Timer.
I think the problem that you are seeing is as of a result of your posting back to the server (albeit, a partial postback), I am guessing, every second.
Gary
-
Nov 25th, 2009, 03:22 PM
#10
Re: Server Clock JS
thanks mendhak, that thought passed my mind also!
i used to use JS clock with my old website but it didn't worked well with google's chrome browser, i'll search for the clock that suite my need in the link you supplied
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 03:23 PM
#11
Re: Server Clock JS
so i guess sticking with JS is what i need for my clocks usage :B thanks guys!
* Rate It  If you Like it
__________________________________________________________________________________________
" Programming is like sex: one mistake and you’re providing support for a lifetime."
Get last SQL insert ID 
-
Nov 25th, 2009, 03:26 PM
#12
Re: [RESOLVED] Server Clock JS
Hey,
For some things, you really need to stick with JavaScript, it is the only thing that really makes sense. Bottom line is, if you don't need to get information from the server, then stick in the client.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|