473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

timer to delay execution of event

Lets say I want a button to execute 10 seconds after I press it, not
immediately.
Any ideas how to cause that, in a code-behind. IMO its only server side
code, I don't think javascript needs to get in to the equation (?)
Nov 19 '05 #1
8 5881
you cant do it in codebehind, it would have to be a clientside delay. You
COULD, have the button fire but "wait" (n) seconds before it does something,
but why? I mean what is it you need to get at that needs the delay?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jason Shohet" <__******@yahoo .com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Lets say I want a button to execute 10 seconds after I press it, not
immediately.
Any ideas how to cause that, in a code-behind. IMO its only server side
code, I don't think javascript needs to get in to the equation (?)

Nov 19 '05 #2
I just want to see if it actually works, I'm tinkering. I used it once to
cause a screen refresh w/o a postback. Now I'm trying to see if I can
postpone execution w/ a js func, then have it return to do the rest of the
code. ie:

in page load: this.button8.At tributes.Add("o nclick", pr()");

in button8_Click: Response.Write( "hi, did this not appear right away?");

in the aspx: <script>
function pr() {
window.setTimeo ut("pr()", 100);
}
<script>

Alas, it doesn't seem to work. The message appears right away. I figured
the js timer would delay execution on the Response.Write. ..?
Nov 19 '05 #3
You are mixing client and server events up....
You can delay the POST to the server, or you can delay the execution within
the code-behind from within it, but you can't have any interaction between
the two while this is happening.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jason Shohet" <__******@yahoo .com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I just want to see if it actually works, I'm tinkering. I used it once to
cause a screen refresh w/o a postback. Now I'm trying to see if I can
postpone execution w/ a js func, then have it return to do the rest of the
code. ie:

in page load: this.button8.At tributes.Add("o nclick", pr()");

in button8_Click: Response.Write( "hi, did this not appear right
away?");

in the aspx: <script>
function pr() {
window.setTimeo ut("pr()", 100);
}
<script>

Alas, it doesn't seem to work. The message appears right away. I
figured the js timer would delay execution on the Response.Write. ..?

Nov 19 '05 #4
ok i see.... Alright, then I know how to delay the POST to the server from
b4.
What I'm not sure is the 2nd scenario, the code to delay the execution of
the c.behind from within the c.behind?
Nov 19 '05 #5
It will be tricky... but traditionally you call the form.submit() in the
timer-delay. In this case though you will have to have it fire the
individual buttons click, unless you can use the page_load and IsPostBack()

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jason Shohet" <__******@yahoo .com> wrote in message
news:Of******** ******@TK2MSFTN GP09.phx.gbl...
ok i see.... Alright, then I know how to delay the POST to the server
from b4.
What I'm not sure is the 2nd scenario, the code to delay the execution of
the c.behind from within the c.behind?

Nov 19 '05 #6
TY, I'm going to look up timer-delay syntax in c#, and also ask around on
the c# ng.
if it seems way to difficult i'll give up, its more of a curiosity to see if
it can be done
Nov 19 '05 #7
actually i think just Thread.Sleep (1000) does it :)
Nov 19 '05 #8
It is tough.... you are basically trying to put the thread/process to sleep
(search on "sleep"). There is realy no need to ever do this, or rather
shouldnt be. It's like pausing lifesupport.... .

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jason Shohet" <__******@yahoo .com> wrote in message
news:Og******** ******@TK2MSFTN GP10.phx.gbl...
TY, I'm going to look up timer-delay syntax in c#, and also ask around on
the c# ng.
if it seems way to difficult i'll give up, its more of a curiosity to see
if it can be done

Nov 19 '05 #9

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

Similar topics

3
5609
by: ELO | last post by:
Hi all Every week, I need to get two files on a remote server. I have developped a C# Windows Service with two System.Threading.Timer to do this task For the first one, the delay (TimeSpan dueTime) is always set to 6 days, 23 hours, 59 minutes, .. Some weeks ?!?, the timer restarts immediately after its execution (and loop indefinitely). I have made a lot of tests and this issue does not occur with a delay < 1 day .. Any suggestion
4
2314
by: vinay | last post by:
Hi, I need to use a Timer at run time. I have created a Timer class which has method 'CreateTimer'. I am able to create a timer and run the associated event (code snippet follows), but I am unable to: 1. Stop this timer. 2. Give it a specific Name (sTimer), so that I can
4
782
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I make a 10 second delay? ----------------------------------------------------------------------- There is no built-in way to pause execution in javascript such as a sleep function, but hosts usually provide a method of some form. Web browsers are designed for event driven programming and only provide the « setTimeout » and « setInterval »...
19
40819
by: UG | last post by:
I just wanted to know whether any timer facility exists in C, as it is not mentioned in K&R 2, or in the ISO Draft. By timer function i mean that when we use standard input function like scanf() or getch() or any other function, the interface stops to take input from user but what if user doesn't give input for hours, the program will still be waiting. Is there any way to circumvent the scanf() (or any other input function for that matter)...
3
2475
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am trying to use the timer to make a login form show after a specified interval. However, if the interval is set to a value greater than 5000 nanosecond, then it does not respond. What could be the issue here? Thanks. private void frmMain_Load(object sender, EventArgs e) { this.timer = new Timer();
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9942
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.