Populating List

G

Guest

a combo box that starts off empty. The user can type int he combo box, and as
he types, after the third letter has been typed, the page does a lookup
against a database (SQL String) to our server, and populates the combo with
matches, and the combo box drops down so they can see them. There would be
two fields in the combo box, Firm Name and City. They could either pick from
the list or keep typing to narrow the search down. With each successive
keystroke (after three) we would execute the search again and re-populate the
listbox. For example, the user could type in "State" and would get a list of
maybe 30 matches for that text in a list or combo box above that name field
on the order form. They could then select from that list. If there were no
matches they could delete what they've typed and try again, or give up and
simply type out the whole name and address on the order form without using
the list.

I am using VS.NET 2003.

Please let me know how to achieve this
 
S

sirfunusa

I doubt you'll want to hit the database after they type some letters.
The pause and repopulate would be very annoying, I would think...the
page would refresh each time. Unless you use some advanced technique
like AJAX. So, bring everything (if you can) clientside to start with,
then use client scripting to achieve the same result.
 
C

Chris Fulstow

Sounds like you want something similar to Google Suggest:
http://www.google.com/webhp?complete=1&hl=en

This uses AJAX techniques to keep refreshing the list without having to
reload the page. A blogger Chris Justus has disected the code behind
this and has also deciphered the JavaScript. Hopefully it might
provide some useful hints:
http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html

You might also want to look at caching your data, maybe in a DataSet in
the Cache object, so it doesn't bombard your database with requests at
every keystroke.

Cheers,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top