Solved

Quickest method for populating a Listbox in ASP

Posted on 2004-03-29
4
215 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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
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.
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…

762 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

6 Experts available now in Live!

Get 1:1 Help Now