Linking listboxes together

G

Guest

Hello,

I need to dynamicaly populate a second listbox, based on the value, that the
user has chosen in the first listbox.

A good example of what i mean, is this site:

http://www.nvidia.com/content/drivers/drivers.asp
The second and third boxes getting filled, depending on the value in the
previous box.

I need to populate the listboxes with values from a database, and i ran into
more problems than expected. I am sure, some one here has developed something
similiar. Please help.

Thanks.
 
A

Alex Homer

You'll either have to force a postback using AutoPostback on the listbox and
run server-side code to populate the second listbox, or find a way to pass
the values for the second listbox to the client. You could build up a
JavaScript array in the client-side code section of the page that contains
all the possible values from the database, and then use client-side code in
response to the client-side events of the first listbox to insert the values
into the second listbox.

Note that if you do it client-side, the values will not be available in the
usual way on the server after a submit/postback - i.e. they will not appear
in the Items collection.Instead, you'll have to extract them from the
Request.Form collection (where they are stored as a comma-delimited string).

"the friendly display name"
 

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

Top