Solved

Quickest method for populating a Listbox in ASP

Posted on 2004-03-29
4
222 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
[X]
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
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
This is about my first experience with programming Arduino.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

617 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