Solved

Replace AJAX timed event with textbox onchange event

Posted on 2011-02-16
8
523 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
popup message 3 27
asp.net mvc5 3 38
Execute Stored Procedure for a set of values 5 27
Jquery autocomplete 10 27
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now