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
Solved

Quickest method for populating a Listbox in ASP

Posted on 2004-03-29
4
218 Views
Last Modified: 2010-04-17
I am building a reporting tool.  Each report can be filtered by a postcode or multiple postcodes.

I am successfully populating a multiselect listbox in asp with over 2500 postcodes using the following code

<SELECT MULTIPLE id="lstPostcode" name="lstPostcode" value="lstPostcode" size=2 onclick="DeSelectPostcodeChkbox()" style="HEIGHT: 70px; WIDTH: 80px">
      <%
      Do while not rsPostcode.eof
      Response.Write "<Option Selected Value='" & Trim(rsPostcode("Postcode")) & "'>" & Trim(rsPostcode("Postcode")) & "</Option>" & vbcrlf
            rsPostcode.MoveNext
      loop
      rspostcode.close
      %>
       </SELECT>

However it is very slow in the live environment.  Is there a quicker way to code this or can someone offer a alternative solution?  
0
Comment
Question by:cgibbons123
4 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 25 total points
ID: 10711048
Hi cgibbons123,

Perhaps you can divide the selects into two selects.
One contains the possibly states and other contains postal codes in the state.

So when someone selects a state the other must be automatically updated with the postal codes...

This way you dont have to display all the 2500 codes...

Cheers!
venkat.
0
 
LVL 44

Assisted Solution

by:Arthur_Wood
Arthur_Wood earned 25 total points
ID: 10713967
the real derlay is NOT in the loading of the Listbox in your code, but the DOWNLOADING of the page, with the 2500 entries for that listbox, to the client browser.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
silent install of security banner via msiexec command 4 94
Help Required 2 39
incorrect syntax near the order by 10 39
learn programming 8 30
This article will show, step by step, how to integrate R code into a R Sweave document
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

792 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