?
Solved

Replace AJAX timed event with textbox onchange event

Posted on 2011-02-16
8
Medium Priority
?
545 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Accepted Solution

by:
jorge_toriz earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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