How to insert at first

Discussion in 'ASP .Net' started by ad, Jun 17, 2006.

  1. ad

    ad Guest

    I have a dropdownlist, and it's Items is bound to a TableAdapter.
    After the Dropdownlist bound, I want to add a items to the DropDownList's
    Items, but it always at bottom.

    How can I add the new items at the top?
     
    ad, Jun 17, 2006
    #1
    1. Advertising

  2. ad

    Shawn Guest

    Like this:
    myDropDownList.Items.Insert(0, "new value")



    "ad" <> wrote in message
    news:...
    I have a dropdownlist, and it's Items is bound to a TableAdapter.
    After the Dropdownlist bound, I want to add a items to the DropDownList's
    Items, but it always at bottom.

    How can I add the new items at the top?
     
    Shawn, Jun 17, 2006
    #2
    1. Advertising

  3. ad

    Teemu Keiski Guest

    And if you want to give both text and value, then

    myDropDownList.Items.Insert(0, New ListItem("text","value"))

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke


    "Shawn" <> wrote in message
    news:e%...
    > Like this:
    > myDropDownList.Items.Insert(0, "new value")
    >
    >
    >
    > "ad" <> wrote in message
    > news:...
    > I have a dropdownlist, and it's Items is bound to a TableAdapter.
    > After the Dropdownlist bound, I want to add a items to the DropDownList's
    > Items, but it always at bottom.
    >
    > How can I add the new items at the top?
    >
    >
    >
     
    Teemu Keiski, Jun 17, 2006
    #3
    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. cannontrodder
    Replies:
    1
    Views:
    733
    cannontrodder
    Jul 25, 2006
  2. Replies:
    1
    Views:
    454
  3. Replies:
    1
    Views:
    1,788
    Albert Hopkins
    Dec 6, 2008
  4. eagle

    Insert & Insert/Repeat buttons in a detailsview

    eagle, Jul 12, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    1,060
    eagle
    Jul 12, 2007
  5. Feege
    Replies:
    0
    Views:
    460
    Feege
    Dec 20, 2005
Loading...

Share This Page