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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error in query expression 3 56
Query still returning duplicates 5 58
Asp in script 6 51
Clear input text 15 32
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…
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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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