Adding value to dropdownlist

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Apr 15, 2005.

  1. I have a dropdown bound to database. I need to add Select one to the first
    index of drop down list.

    How can i do this?

    Thanks

    Manny
    =?Utf-8?B?TWFubnkgQ2hvaGFu?=, Apr 15, 2005
    #1
    1. Advertising

  2. After you have populated your dropdown use something like the following
    (assuming your dropdown is ddlList)

    ListItem li = new ListItem("Text","Value");
    ddlList.Items.Insert(0,li);
    ddlList.SelectedIndex = 0;

    This should Work

    Tasos


    "Manny Chohan" wrote:

    > I have a dropdown bound to database. I need to add Select one to the first
    > index of drop down list.
    >
    > How can i do this?
    >
    > Thanks
    >
    > Manny
    =?Utf-8?B?SWFub3M=?=, Apr 15, 2005
    #2
    1. Advertising

  3. =?Utf-8?B?TWFubnkgQ2hvaGFu?=

    Lucas Tam Guest

    =?Utf-8?B?TWFubnkgQ2hvaGFu?= <>
    wrote in news::

    > I have a dropdown bound to database. I need to add Select one to the
    > first index of drop down list.
    >
    > How can i do this?



    Dim li as listitem = new listitem("MyText", Value)

    ddl.items.add(li)

    : )


    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
    Lucas Tam, Apr 16, 2005
    #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. mr2_93
    Replies:
    1
    Views:
    3,582
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,206
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,848
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,283
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. ericnoonan
    Replies:
    0
    Views:
    336
    ericnoonan
    Dec 14, 2009
Loading...

Share This Page