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

Data displayed from dropdown moving down the page

Below is the code in my sub that is displaying the inventory when a color is chosen from a dropdown menu.  When you select the first color in the list it lists the inventory directly next to 'Available Inventory:' When you select the second color it moves down 2 lines, the third color moves down 3 lines.  I assume it has to do with my loop, any ideas?

    intrecordcount = objRS.recordcount
    stylecount = 0

    response.Write "<tr><td><font size=""2pt"">Available Inventory: </font></td>"
    
    while not objRS.eof
    
    stylecount = stylecount + 1
    
    response.Write "<td>"& vbCRLF

    if request.QueryString("Color_id") <> "" then    'if there is a color selected show that colors inventory
        if clng(objrs.fields("color_id")) = clng(request.QueryString("Color_id")) then
            if isnull(objRS.fields("Color_value")) then
            else
            response.write ("<font size=""2pt"">"&objRS.fields("Color_value")&" - </font>")
            end if
            if isnull(objRS.fields("Size_value")) then
            else
            response.write ("<font size=""2pt"">"&objRS.fields("Size_value")&" - </font>")
            end if
            response.Write ("<font size=""2pt"">"&objRS.fields("Inventory")&"</font>")    
            end if
         end if


    if intrecordcount = stylecount then
        response.Write "</td></tr>"
    else
       response.Write "</td></tr><tr><td>"
    end if
   
    objRS.movenext
    wend

    response.Write "<tr><td colspan=""2""><hr color=""dfdfdf"" /></td></tr>"& vbCRLF

Open in new window

0
AdrienneSperber
Asked:
AdrienneSperber
  • 3
  • 2
1 Solution
 
GaryCommented:
In your loop your moving to the next row with each iteration, you are also setting <td> at the start and end so that will be double up.
But your question is not really clear what is moving/wrong, when you change a select box, when you reload the page...?
0
 
AdrienneSperberAuthor Commented:
The dropdown uses an onchange function and reloads the page to display the inventory for the color selected in the menu.  The inventory that is displayed moves down a space on the page.
0
 
GaryCommented:
Post the actual html from the page or better a link
0
 
AdrienneSperberAuthor Commented:
0
 
GaryCommented:
You're obviously selecting all colors in the sql, why not just select the rows that match the color then you wouldn't have all those blank rows where the color doesn't match the ID.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

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