remove an item from a dropdownList

Discussion in 'ASP .Net Web Controls' started by Patrick Beaudoin, Aug 4, 2003.

  1. Hello Adil,
    this is my suggestion:

    1-
    drdMedicine.Items.Add(New ListItem("All", "0"))
    drdMedicine.Items.Remove(New ListItem("All", "0"))

    2-
    drdMedicine.Items.Add("All")
    drdMedicine.Items.Remove(New ListItem("All")

    >-----Original Message-----
    >Hi all,
    >
    >I'm using a dropdownlist to store some data. in the

    page_load function i
    >added an default item by this function
    >drdMedicine.Items.Add(New ListItem("All", "0"))

    drdMedicine.SelectedValue = 0
    >
    >but if the user clicks a button (named ibtNew), this

    item should be removed,
    >i tried this function but it's not working,
    >
    >drdMedicine.Items.Remove("All")
    >
    >
    >
    >can someone help me please,
    >
    >thanks in advance,
    >
    >Adil
    >
    >
    >.
    >
     
    Patrick Beaudoin, Aug 4, 2003
    #1
    1. Advertisements

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. gce

    Tabstrip with remove item

    gce, Mar 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,383
    Jason Bentley
    Mar 28, 2005
  2. Simon-Pierre  Jarry
    Replies:
    2
    Views:
    2,608
    Henrik
    Aug 10, 2005
  3. et

    Remove an item from a list

    et, Jan 5, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    6,037
  4. Gunnar G

    remove an item in a STL list

    Gunnar G, Feb 8, 2005, in forum: C++
    Replies:
    9
    Views:
    881
    Pete Becker
    Feb 9, 2005
  5. sam
    Replies:
    12
    Views:
    9,793
    Mike Wahler
    May 12, 2005
  6. Kieran Simkin
    Replies:
    7
    Views:
    526
    Kieran Simkin
    May 11, 2004
  7. tshad
    Replies:
    6
    Views:
    21,758
    tshad
    Aug 8, 2006
  8. Kylin

    How to Remove item from DropDownList ?

    Kylin, Apr 25, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    221
    Angrez Singh
    Apr 25, 2005
Loading...