Listboxes

Discussion in 'ASP .Net' started by Big E, Jul 19, 2004.

  1. Big E

    Big E Guest

    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
    Big E, Jul 19, 2004
    #1
    1. Advertising

  2. Big E

    Mike Smith Guest

    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 ?


    "Big E" <> wrote in message
    news:...
    > 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
    >
    >



    ---
    Outgoing mail is certified Virus Free. (well i'd like to think it is.. )
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.723 / Virus Database: 479 - Release Date: 19/07/2004
    Mike Smith, Jul 20, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill yeager

    listboxes.........

    bill yeager, Aug 8, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    632
    Prakash
    Aug 11, 2003
  2. Replies:
    1
    Views:
    289
  3. Big E

    ASP.Net Listboxes

    Big E, Jun 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    343
    John Saunders
    Jun 15, 2004
  4. Terry D

    Listboxes don't always show

    Terry D, Jun 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    307
    Terry D
    Jun 15, 2004
  5. Ryan Ternier
    Replies:
    1
    Views:
    543
    John Saunders
    Jul 25, 2004
Loading...

Share This Page