Solved

Replace AJAX timed event with textbox onchange event

Posted on 2011-02-16
8
526 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET reading ATOM 2 52
Asp.net mvc 5 5 44
Display mvc partial view with errors on parent page 1 26
Tool Box 2 35
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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

18 Experts available now in Live!

Get 1:1 Help Now