Solved

Quickest method for populating a Listbox in ASP

Posted on 2004-03-29
4
217 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

772 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