Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Problem in halt execution in betn


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.
  • 7
  • 3
1 Solution
There's no sleep command in ASP, but using javascript, you can do what you want to do...


will halt where u want it to halt executing.

:) SD
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

kamlesh_agrawalAuthor Commented:
but if i use response.end or exit for loop then

If user selects continue option how will i resume it.
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
kamlesh_agrawalAuthor Commented:
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.
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
@  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
kamlesh_agrawalAuthor Commented:

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
> 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
no objections from me.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now