Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer

Status
Not open for further replies.

ac11nyc

Programmer
Oct 1, 2003
94
US
Im trying to launch a save event every 60 seconds using a timer. I use to know how to do this but cant quite rememeber how i did it. does anyone know how to do this??

either using Javascript or code-behind will work. thanks
 
Dim withevents new t as timer (module level)

sub Form_OnLoad ()
set t.interval = 60000 (1 min)
t.enabled = true
end sub

sub t_tick(someargs?)
dbsave()
end sub

Or something like that....
 
Stupid Me!!!!
Wrong forum...
You need to use DHTML and execute a form.post at the correct moment or use a component that can do this for you... (probably dhtml)

Sample code might be something like (althought I use this to do a refresh.. YOu just need to change it for your purposes.,


Code:
<script language="vbscript">
<!--
sub Refresh()
	form1.submit
end sub
sub StartRefresh()
	window.setInterval "Refresh",30000
end sub
-->
</script>
YOu will proabably need to also convert it to JavaScript

:)

Rob
 
Forgot 1 other piece

You need to execute the function/sub that begins the task..
(window.setinterval) and points it at the function needed with the interval...


Code:
<body onload="StartRefresh" language="vbscript">

Again you will want to call the forms.submit method rather than do a browser refresh.

Rob
 
I know how to launch a refresh event using a timer, the question is how do i launch a function from the code behind using a timer. I want to launch a save function every minute using a timer & i do not know how to pull this off.
 
You need to submit form data back to your server and onpostback do your save..

Try calling Form.Submit from the timer code.. where Form is the name of the Form that ASP.net adds to enable the use of serverside controls..


Then in the Form_Load check if it is a postback and if so do the save...

Code in your codebehind page is back on hte server. THerfore you need to post your form databack.

HTH

Rob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top