DropDownList

Discussion in 'ASP .Net' started by Jim Heavey, Nov 17, 2003.

  1. Jim Heavey

    Jim Heavey Guest

    When you are binding a dropdown to a datasource, you have
    2 properties to set, the DataTextField and DataValueField.

    If you are going to load the entries manually in code
    rather then use the databind, how do you set these
    properties?

    I know (think) that if you are just loading the "text"
    field, you just go drpdwon.items.add("MyTest"), but how
    do you populate the equivalent to the "value" field.

    Thanks in advance for your assistance!!!!!!!
     
    Jim Heavey, Nov 17, 2003
    #1
    1. Advertisements

  2. MyDropDownList.Items.Add(New ListItem("Your Text Here", "Your Value Here"))

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Big Things are made up of
    Lots of Little Things.

    "Jim Heavey" <> wrote in message
    news:0a6801c3ad4f$9bdba2b0$...
    > When you are binding a dropdown to a datasource, you have
    > 2 properties to set, the DataTextField and DataValueField.
    >
    > If you are going to load the entries manually in code
    > rather then use the databind, how do you set these
    > properties?
    >
    > I know (think) that if you are just loading the "text"
    > field, you just go drpdwon.items.add("MyTest"), but how
    > do you populate the equivalent to the "value" field.
    >
    > Thanks in advance for your assistance!!!!!!!
     
    Kevin Spencer, Nov 17, 2003
    #2
    1. Advertisements

  3. Jim Heavey

    Jim Heavey Guest

    Thanks
     
    Jim Heavey, Nov 18, 2003
    #3
    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. kalyani mantripragada

    editable dropdownlist COM

    kalyani mantripragada, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    699
    kalyani mantripragada
    Oct 29, 2003
  2. mr2_93
    Replies:
    1
    Views:
    3,914
    mr2_93
    Oct 2, 2005
  3. tshad
    Replies:
    8
    Views:
    2,493
    tshad
    Oct 19, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,064
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  5. =?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,514
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  6. keithb
    Replies:
    1
    Views:
    12,797
    shauns1
    Nov 1, 2006
  7. S_K
    Replies:
    5
    Views:
    997
    Eliyahu Goldin
    Nov 14, 2007
  8. Lagrange
    Replies:
    1
    Views:
    788
    Lagrange
    Jan 17, 2009
Loading...