DropDownList Value

Discussion in 'ASP .Net Web Controls' started by Joe Reiss, Nov 26, 2005.

  1. Joe Reiss

    Joe Reiss Guest

    Hi All,

    How do I get the value of the DataValueField that is selected. I don't want
    the SelectedValue I want the actual field value.

    So, if I display Staff Names within the drop down list, I don't want the
    Staff Name, I want the StaffID which is the value contained in the
    DataValueField.

    Thanks,
    Joe
     
    Joe Reiss, Nov 26, 2005
    #1
    1. Advertising

  2. Joe Reiss

    Hans Guest

    It should be like this.

    value=ddownlist.items[ddownlist.selectedindex].value;
    textvalue=ddownlist.items[ddownlist.selectedindex].text;

    this Borland like language, but in Studio languages it should sound
    familiar.

    Hans


    "Joe Reiss" <> schreef in bericht
    news:TC2if.27619$...
    > Hi All,
    >
    > How do I get the value of the DataValueField that is selected. I don't
    > want the SelectedValue I want the actual field value.
    >
    > So, if I display Staff Names within the drop down list, I don't want the
    > Staff Name, I want the StaffID which is the value contained in the
    > DataValueField.
    >
    > Thanks,
    > Joe
    >
     
    Hans, Nov 29, 2005
    #2
    1. Advertising

  3. Joe Reiss

    Joe Reiss Guest

    Thanx,
    I was able to work it out. 'Borland like' doesn't surprise me since C# is
    Anders Heilsberg (spelling?) baby. Of course he was mostly responsible for
    Delphi of which has been my development language since 1995.


    "Hans" <> wrote in message
    news:438c98cc$0$2336$...
    > It should be like this.
    >
    > value=ddownlist.items[ddownlist.selectedindex].value;
    > textvalue=ddownlist.items[ddownlist.selectedindex].text;
    >
    > this Borland like language, but in Studio languages it should sound
    > familiar.
    >
    > Hans
    >
    >
    > "Joe Reiss" <> schreef in bericht
    > news:TC2if.27619$...
    >> Hi All,
    >>
    >> How do I get the value of the DataValueField that is selected. I don't
    >> want the SelectedValue I want the actual field value.
    >>
    >> So, if I display Staff Names within the drop down list, I don't want the
    >> Staff Name, I want the StaffID which is the value contained in the
    >> DataValueField.
    >>
    >> Thanks,
    >> Joe
    >>

    >
    >
     
    Joe Reiss, Dec 2, 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,675
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,271
    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,899
    =?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,338
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    12,174
    shauns1
    Nov 1, 2006
Loading...

Share This Page