53 users online (0 members and 53 guests)  


  Results 1 to 10 of 10

Related

  1. If statement inside <td>    Forum: CGI Perl Forum
    Replies: 1
  2. Scrool bar inside table    Forum: HTML Forum
    Replies: 0
  1. #1
    martin(rps)'s Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Location
    notts uk
    Posts
    7

    Smile Else If inside While Wend

    Hello!

    Would anyone be able to help me with a newbie question?

    I have an asp page displaying recordsets of items. The items are displayed using a repeat region created by d/weaver with a "While Wend". The page worked fine until I put an "Else If" statement into it. The statement is inbetween the While and Wend mentioned above.

    As an asp learner I coded the Else If by hand.... which is probably why I'm having trouble :0)

    I know there's a limit to the amount of code you can post, so I have just included the While Wend section of the page. If any more would help, please let me know.

    Any advice or pointers would be very very very much appreciated!

    Thank you! Martin


    ps. The error message is:

    "Expected statement
    /finalretroposter/RPS_Pages/DisplayPosters/TMPakwpmpytpj.asp, line 169
    Wend"

    Where line 169 = 5 lines in from the end of the below.




    <%
    While ((Repeat1__numRows <> 0) AND (NOT rstDisplayItemsCategory.EOF))
    %>
    <tr>
    <td rowspan="2" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td align="center" valign="top"><a href="Show_Poster.asp?Image_Name=<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>"><img src="../../Images/135x96/<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>" width="<%=(rstDisplayItemsCategory.Fields.Item("ThWidth").Value)%>" height="<%=(rstDisplayItemsCategory.Fields.Item("ThHeight").Value)%>" border="0" align="top"></a></td>
    </tr>
    </table>
    <p><span class="10ptGeorgiaBold"><%=(rstDisplayItemsCategory.Fields.Item("Editions_Remaining").Value)%></span><span class="10ptGeorgia"> eds left /</span>
    <a href="Show_Poster.asp?Image_Name=<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>" class="10ptGeorgia">details</a></p></td>
    <td rowspan="2" align="center" valign="top">&nbsp;</td>
    <td align="left" valign="top"> <p class="LayerMenuSubHeader">Free
    Stuff</p></td>
    <td align="left" valign="top" class="headerTextLinks">&nbsp;</td>
    <td align="left" valign="top" class="headerTextLinks"><div align="left">


    <%
    If rstDisplayItemsCategory.Fields.Item("Editions_Remaining")=0 Then
    %>
    This print has sold out. Sorry!
    <%
    Else If rstDisplayItemsCategory.Fields.Item("Editions_Remaining")<>0 Then
    %>

    Order
    your copy (<font color="#CC0000">#<%=(rstDisplayItemsCategory.Fields.Item("Next_Edition").Value)%></font> of 100):
    <%
    End If
    %>
    </div></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="10ptGeorgia"> <table width="100%" border="0" cellspacing="0" cellpadding="2">
    <tr>
    <td><p><a href="Send_To_A_Friend.asp?Image_Name=<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>" class="10ptGeorgia">
    email pic</a></p></td>
    </tr>
    <tr>
    <td><p><a href="Wallpaper.asp?Image_Name=<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>" class="10ptGeorgia">wallpaper</a>
    </p></td>
    </tr>
    <tr>
    <td><p><a href="Print_Poster.asp?Image_Name=<%=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)%>" class="10ptGeorgia">print</a></p></td>
    </tr>
    </table></td>
    <td align="left" valign="top">&nbsp;</td>
    <td align="left" valign="top"> <form name="form1" method="post" action="">
    <p align="left"><span class="LayerMenuSubHeader">on:</span>
    <select name="paper" id="select2">
    <%
    While (NOT rstPapers.EOF)
    %>
    <option value="<%=(rstPapers.Fields.Item("Paper_Code").Value)%>" class="inputheader"><%=(rstPapers.Fields.Item("Paper").Value)%>
    = <%= FormatCurrency((rstPapers.Fields.Item("Cost").Value), 0, -2, -2, -2) %></option>
    <%
    rstPapers.MoveNext()
    Wend
    If (rstPapers.CursorType > 0) Then
    rstPapers.MoveFirst
    Else
    rstPapers.Requery
    End If
    %>
    </select>
    <br>
    <a href="../PopUps/Poster_Papers.asp"><span class="9ptGeorgia">
    </span></a></p>
    <p align="left" class="LayerMenuSubHeader">&nbsp;</p>
    <div align="left">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td align="left"> <div align="left">
    <input name="addtobasketbutton" type="submit" id="addtobasketbutton" value="Add To Basket">
    <a href="../PopUps/Poster_Papers.asp"><span class="9ptGeorgia">papers
    info</span></a> </div></td>
    </tr>
    </table>
    </div>
    </form></td>
    </tr>
    <tr>
    <td colspan="5"><span class="10ptGeorgiaBold"><font color="#000000"><%=(rstDisplayItemsCategory.Fields.Item("Item").Value)%></font></span> <hr noshade></td>
    </tr>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    rstDisplayItemsCategory.MoveNext()
    Wend
    %>

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Else If inside While Wend

    hmm... i do not know ASP, but i don't believe the problem is in that section...

    attach the file as txt file in your next post... that would be much eassier.

    i have an idea of why it is not working, but not 100% sure.

    -ALL

  3. #3
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Else If inside While Wend

    You have a missing "End if" but I have no idea where that should go. Look at the code you added. The "End if" probably belongs with that.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  4. #4
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Else If inside While Wend

    that's exactly what i thought the problem is, but wasnt sure... my other thought was maybe he did something like:
    Code:
    If var_a = var_b Then
    a = 0
    While not a = 0
    a = 1
    End if
    Whend
    that is what i was thinking the peoblem was, or what you said

  5. #5
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Else If inside While Wend

    It's definitely an "End if" problem. I counted the number of If's in his code and the number of End if's, and came up short on one End if.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  6. #6
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Else If inside While Wend

    i don't think so, i made the code uniform so it is eassier to see, and took out all the HTML, so we are looking at only the code.

    Code:
    While ((Repeat1__numRows <> 0) AND (NOT rstDisplayItemsCategory.EOF))
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	=(rstDisplayItemsCategory.Fields.Item("ThWidth").Value)
    	=(rstDisplayItemsCategory.Fields.Item("ThHeight").Value)
    	=(rstDisplayItemsCategory.Fields.Item("Editions_Remaining").Value)
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	If rstDisplayItemsCategory.Fields.Item("Editions_Remaining")=0 Then
    	Else If rstDisplayItemsCategory.Fields.Item("Editions_Remaining")<>0 Then
    		=(rstDisplayItemsCategory.Fields.Item("Next_Edition").Value)
    	End If
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	=(rstDisplayItemsCategory.Fields.Item("Image_Name").Value)
    	While (NOT rstPapers.EOF)
    		=(rstPapers.Fields.Item("Paper").Value)
    		= FormatCurrency((rstPapers.Fields.Item("Cost").Value), 0, -2, -2, -2)
    		rstPapers.MoveNext()
    	Wend
    	If (rstPapers.CursorType > 0) Then
    		rstPapers.MoveFirst
    	Else
    		rstPapers.Requery
    	End If
    	=(rstDisplayItemsCategory.Fields.Item("Item").Value)Repeat1__index=Repeat1__index+1
    	Repeat1__numRows=Repeat1__numRows-1
    	rstDisplayItemsCategory.MoveNext()
    Wend
    i don't see a problem in here, but then again i don't much about ASP.

  7. #7
    martin(rps)'s Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Location
    notts uk
    Posts
    7

    Thumbs up Re: Else If inside While Wend

    Hi,

    That's a fantastic response - thank you all very much.

    Apologies for not reporting back sooner... I thought I signed up for instant notification... obviously did something wrong. Looks like posting text files is the way forward in the future. And if appropriate I'll just post code without the html to make things clearer. Thanks for your patience with that too.

    I got it working by changing "Else If" to "Elseif" - though I don't understand the difference. Does that light a bulb for anyone?

    Cheers, Martin

  8. #8
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Else If inside While Wend

    oh... i know VB6 & VB.NET, which is supposted to be very close to ASP and VB uses "Else If"...

    glad yo hear you solved it

  9. #9
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Else If inside While Wend

    Quote Originally Posted by martin(rps)
    I got it working by changing "Else If" to "Elseif" - though I don't understand the difference. Does that light a bulb for anyone?
    Cheers, Martin
    Not really. I went back through some old ASP scripts I had written, and they use "else if" just like you had originally. Maybe the version of ASP that you're using requires a different syntax. That's all I can think of that makes any sense.

    Well, the important thing is that you got your script working. Congratulations!
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  10. #10
    martin(rps)'s Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Location
    notts uk
    Posts
    7

    Smile Re: Else If inside While Wend

    Yeah I'm well pleased. Thanks again for all your help folks.



Tags for this Thread