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

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

  3. Jim Heavey

    Jim Heavey Guest

    Thanks
    Jim Heavey, Nov 18, 2003
    #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. keithb
    Replies:
    1
    Views:
    11,916
    shauns1
    Nov 1, 2006
Loading...

Share This Page