Solved

Replace AJAX timed event with textbox onchange event

Posted on 2011-02-16
8
529 Views
Last Modified: 2012-05-11
I currently have an asp.net /framework 4 / (VB) application.
One page has an AJAX timer control whose OnTick event is to run a subroutine which updates a value in a textbox.  The subroutine takes the current value in the textbox as one of its arguments.

e.g.
Page Load
 Textbox value = "0"
Tick 1
 Sub fires with currentrecord=0
 Does some processing
 Increments textbox value by 1 (hopefully before Tick 2!)
Tick 2
 Sub fires with currentrecord=1
 Does some processing
 Updates textbox value to 2 (hopefully before Tick 3!)


This subroutine varies in execution time typically between 2 and 10 seconds but potentially more.  I've set the AJAX Timer to 20 seconds to ensure the sub runs in time but this can be very wasteful of time if a the sub completes long before the next timer tick.

How can I have an AJAX-like callback each time the previous sub completes and updates the textbox?  I'd basically like this sub routine to repetitively fire until the textbox value does not change and update the textbox vlue in the browser each time.

I've tried adding an ontextchanged command to the the textbox but it appears to wait for the timer event.

Any ideas?
0
Comment
Question by:Beamson
  • 4
  • 2
8 Comments
 
LVL 1

Author Comment

by:Beamson
ID: 34905539
Just an idea:

Could the AJAX timer Tick event be used to test whether the sub was still executing?
If so, I could reduce the timer's delay to one second and just poll the server until the sub had completed before rerunning it.  If this is possible, I have no idea how you would make such a test.
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 34911977
You can catch the event endRequest of the ScriptManager to verify if you can do the post
0
 
LVL 1

Author Comment

by:Beamson
ID: 34914385
Hi Jorge.

That sounds interesting.  Can you explain a little more or provide an example?
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 15

Accepted Solution

by:
jorge_toriz earned 250 total points
ID: 34917432
In this link, you can found the code to use the endRequest event of the ScriptManager:

http://msdn.microsoft.com/en-us/library/bb383810.aspx
0
 
LVL 1

Author Comment

by:Beamson
ID: 34924180
It'll take me a while to translate this one - give me the weekend to check it out properly.

0
 
LVL 1

Author Comment

by:Beamson
ID: 35877018
I could not verify completely whether the proposed solution would work and have, unfortunately, now been pulled onto a totally separate project.  I will revisit this when I am next able to but in the meantime am happy to accept AmanBhullar's suggestion.

Many thanks.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 35906842
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question