Solved

Data displayed from dropdown moving down the page

Posted on 2013-06-21
5
274 Views
Last Modified: 2013-06-21
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
Comment
Question by:AdrienneSperber
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39266606
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
 
LVL 9

Author Comment

by:AdrienneSperber
ID: 39266626
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
 
LVL 58

Expert Comment

by:Gary
ID: 39266641
Post the actual html from the page or better a link
0
 
LVL 9

Author Comment

by:AdrienneSperber
ID: 39266662
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39266686
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
dynamics crm 2011 - Web Resources 1 24
encyps queries mssql 15 26
Phone Dialer 5 36
jqplot Pie Chart - javascript 2 9
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now