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

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.


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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

26 Experts available now in Live!

Get 1:1 Help Now