Problem in halt execution in betn

Posted on 2004-08-16
Last Modified: 2008-03-10

Is there any sleep command in ASP.

I want to halt execution of the page in betn and display a pop up page in which user will select whether he wants to continue or stop execution of the parent page.

I m stuck up at holding the execution in between.
Like display a pop up  is not a problem.I can achieve it using javascript's but after this javascript command . I want to halt the execution.

Any Answers?

Kamlesh A.
Question by:kamlesh_agrawal
  • 7
  • 3

Expert Comment

ID: 11812497
There's no sleep command in ASP, but using javascript, you can do what you want to do...

LVL 11

Expert Comment

ID: 11812844

will halt where u want it to halt executing.

:) SD
LVL 11

Expert Comment

ID: 11812889
If you mean.. breaking a loop while it is being executed.

Here is a sample code

For i=1 to 100
response.write i & "<br>"
If i= 99 Then Exit For    'just before 100 is printed out the loop is exited

"Exit" is the word u use.

:) SD
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why


Author Comment

ID: 11818098
but if i use response.end or exit for loop then

If user selects continue option how will i resume it.
LVL 11

Expert Comment

ID: 11821410
u obviously have to use either response.end or exit for

within an if statement.

You need to exit the execution only if you want it to.

Btw, response.end stops execution of ALL the ASP code after that point and I wouldnt recommend it unless u are sure of its usage.

If you are trying to have user interaction in ASP, you cant do it, coz ASP is executed at the server. For user interaction in a loop, use either Javascript or Client-side VbScript.

:) SD

Author Comment

ID: 11821498
No SD,

My requirement is like
I have a loop of say near about 2000 rows

1.Validate the row.
2.Insert into database.

So if there are 10 consecutive invalid rows i need to alert user whether he wants to continue the loop or not.
So i will be providing a pop up page with two radio button yes/no & submit button

So in this loop i have kept the counter which increments when it finds invalid row

and i have kept
If counter = 10 then
'display pop page using javascript

'HERE I WANT TO STOP ASP EXECUTION so that i can get the users response from child window which i will be keeping in session variable.
'SO IF USER SELECTS YES IN CHILD WINDOW. i will continue this loop
'ELSE i will stop using exit for..
counter = 0
end if

Hope this will help u to understand my requirement.

Kamlesh A.
LVL 11

Expert Comment

ID: 11826684
I think I understand what you want. Unfortunately, it cant be done in ASP coz...

ASP is a server-side script.. so once a loop starts, it all happens on the server-end. You could stop the loop to wait for the user-interaction. But by then, the user-interaction is on the client-side and the user cant interact and continue the loop. The user will need to restart the loop.

You could not wait for user interaction and just display a message and continue on with the loop.

:) SD
LVL 11

Expert Comment

ID: 11895275
@  kamlesh_agrawal -

A question for you:

Say I get 10 invalid rows at count 100 and the script throws an error and stops the loop; you can still continue the loop if you start the loop afresh that is from count 1, but start inserting it only from 101. (the count must not change due to the insert)

Where are the rows at? what are u validating? If you can explain this more, maybe we can think of it a way out.

:) SD

Author Comment

ID: 11899905

I just want to halt the execution in betn... and get the user input that if he wants to continue the loop or exit....
Depending upon his selection, like if he selects yes it will continue ahead or if he selects no the loop will break..

One solution is i can refresh the page again after noting down the count where user has selected continue...

but the thing is that i dont want to refresh the page...

Till now , i m under impression that this cannt possible in web based versions.
and i think i m right....

for now i have solved by refreshing the page...

but just giving a thought ....

-Kamlesh Agrawal
LVL 11

Accepted Solution

sciber_dude earned 300 total points
ID: 11909801
> but the thing is that i dont want to refresh the page...

Using ASP, you cant do this without a refresh.

> One solution is i can refresh the page again after noting down the count where
> user has selected continue...

Is the only solution.

:) SD
LVL 11

Expert Comment

ID: 11959790
no objections from me.


Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to remove Duplicates from Generic List in Csharp 5 82
ASP Classic - Load test 2 49
sql to convert to date IF entry is in date format 4 81
ASP SQL Syntax Duplicate Key 7 102
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

809 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