timer on webpage
-
Hi, I try to put a timer on my webpage, and my purpose is to trigger an update of certain content of this page. So I "new" a asp.net web application in Visual Studio.net2003 and "drag and drop" a "timer" component from toolbox to the webform. set "interval" to "2000" and "enable" it. But it doesn't works. If I debug it, looks like the timer doesn't run in the normal style. Does anybody encounter this problem before? Is there a better way to make a webpage update periodically by itself? Thanks. Regards Kevin
-
Hi, I try to put a timer on my webpage, and my purpose is to trigger an update of certain content of this page. So I "new" a asp.net web application in Visual Studio.net2003 and "drag and drop" a "timer" component from toolbox to the webform. set "interval" to "2000" and "enable" it. But it doesn't works. If I debug it, looks like the timer doesn't run in the normal style. Does anybody encounter this problem before? Is there a better way to make a webpage update periodically by itself? Thanks. Regards Kevin
Hey, Kevin. It sounds to me like you want something that will function client-side -- the three types of timers in .NET (in the namespaces
System.Windows.Forms
,System.Timers
, andSystem.Threading
are all server-side. In the context of your ASP.NET page, the server-side processing functions to generate markup to send back to the client. If you wanted to trigger activity client-side, you could do so with the javascript functionsetTimeout()
. There are lots of examples around - Google for "javascript timer" or "javascript setTimeout" and you'll find a bunch. Here's an example of one: http://www.mcfedries.com/JavaScript/timer.asp[^]