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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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