Listboxes

B

Big E

I'm using ASP.Net and SQL Server
I have 2 listboxes. I have a table with 50 states.
In one listbox I want to show the states that are associated with a record.
Let's say 4 states. I can do this.
AL
AK
AR
CA
In the other listbox I want to show whatever states are not in the first
listbox.
Lets say the other 46 states.
..........
How can I use the values of the first listbox to determine whats in the
second. I've tried code that uses the listitem etc... but can't quite get
it.

Thanks.

E
 
M

Mike Smith

well without basically searching the first listbox before appending it to
the second list box the only other way i could think is to filter the
records itself ?

not sure on the efficiency though... if ur using a datareader build a query
that filters out the states u already have using a sql NOT IN ( AL, AK ....)

or

if u got the list of items in a datatable in a dataset i suppose u could get
a dataview done by filtering the states from the first listbox..

Anybody else have a better way ?
 

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

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top