Connecting Tech Pros Worldwide Forums | Help | Site Map

for loop not working, page hangs up.

Newbie
 
Join Date: Mar 2007
Posts: 20
#1: May 24 '07
Hi,

I have two asp pages. when both contain lots of coding, loops etc.

if i run the first page that contain for loop for creating array of textboxes,
then this page run successfully.

but if i include this first page in the second page using <#include.....> then the for loop is not working n page hangs up.

Plz tell me what is the reason.n any solution if any.

thanks in advance.
this is urgent.

jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: May 24 '07

re: for loop not working, page hangs up.


Urgent, huh?

Well it sounds like the loop isn't advancing. There are lots of reasons why a loop might not advance, the most likely is that there is an error that is negating the advancing mechanism. An error would normally cause the page to stop, but if you use an "on error" line that may keep the loop cycling continuously.

A second reason the loop may not advance is if you re-used a variable between the two pages and as the variable is called, it cancels the loop's advance.

So I suggest trying two things: first comment out your error handlers. (this might point out the problem by itself) Second, put in a line that displays the loop index each time the loop executes (this just lets you observe the looping, allows you to verify that it goes correctly):
Expand|Select|Wrap|Line Numbers
  1. for x = 1 to 30
  2.    response.write "<!-- x: " & x & " -->" & vbNewLine
  3. next
  4.  
Jared
Newbie
 
Join Date: Mar 2007
Posts: 20
#3: May 25 '07

re: for loop not working, page hangs up.


Thanks a lot
now it is working by adding 'on error....'
this is a live site work, that is y i was in hurry.......
Reply