Solved

Quickest method for populating a Listbox in ASP

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

912 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

23 Experts available now in Live!

Get 1:1 Help Now