473,480 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Timer in asp.net

Hi all,

I have one label and one button. When I click the button
the label shows "Hello world". What I want to do is after
5 second the hello world is clear. How to do it with
asp.net. Im using vb.net as the languages.

Thanks
Nov 19 '05 #1
6 1030
You'll need to use some client side script for the timer.
Here's an example that uses the javascript setTimeout function.
http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Mr Red" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Hi all,

I have one label and one button. When I click the button
the label shows "Hello world". What I want to do is after
5 second the hello world is clear. How to do it with
asp.net. Im using vb.net as the languages.

Thanks

Nov 19 '05 #2
Hello there,

I try to use the code, I already add the javascript code
inside my asp.net but I have a problem when I call the
function. This is my code

<asp:Button id="btnUpdate" runat="server" Text="Update"
OnClick="startClock()"></asp:Button>

the error message pointer at OnClick="startClock()":
'startClock' is not a member of 'ASP.USER_aspx'.

any idea?

Thanks

-----Original Message-----
You'll need to use some client side script for the timer.
Here's an example that uses the javascript setTimeout function.http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Mr Red" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Hi all,

I have one label and one button. When I click the button the label shows "Hello world". What I want to do is after 5 second the hello world is clear. How to do it with
asp.net. Im using vb.net as the languages.

Thanks

.

Nov 19 '05 #3
<an*******@discussions.microsoft.com> wrote in message
news:11****************************@phx.gbl...
the error message pointer at OnClick="startClock()":
'startClock' is not a member of 'ASP.USER_aspx'.


That's correct. You've defined a web control and told it to run a procedure
called startClock() when it's clicked. Because of the runat=server, the page
will post back and try to run a server-side procedure called startClock().
You need to:

1) Create a client-side Javascript function called startClock()

2) Change the web control button to a regular HTML control: <input
type=button id=btnUpdate value=Update onClick="startClock();"> control.
Rendering it as a web control won't give you any advantage in this case
because you don't need it to interact with the server when it's clicked
Nov 19 '05 #4
Is there any possibility that Im using button from
asp.net rather then from the html? or maybe I can call
the function from code behine?

Thanks
Nov 19 '05 #5
On the web, the page just lives the time of the request. It will be much
more easy to have a client side timer. Plus if you want to hide the button
server side you'll have also an extra request to the server.

ASP.NET does quite a good job to mimic usual event based programming but IMO
it's worth to know what goes under the hood...

Patrice

--

"Mr Red" <an*******@discussions.microsoft.com> a écrit dans le message de
news:11****************************@phx.gbl...
Is there any possibility that Im using button from
asp.net rather then from the html? or maybe I can call
the function from code behine?

Thanks

Nov 19 '05 #6
Yes, you can keep asp.net button. You just need to add client side onclick
attribute like this (C# syntax):

btnUpdate.Attributes["onclick"']="startClock()";

Eliyahu

"Mr Red" <an*******@discussions.microsoft.com> wrote in message
news:11****************************@phx.gbl...
Is there any possibility that Im using button from
asp.net rather then from the html? or maybe I can call
the function from code behine?

Thanks

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
7428
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
2836
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
9
7240
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
2127
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
2
4032
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
12
5489
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
8
6831
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
8
2635
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
11
2565
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
3225
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6966
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.