DropDownList Value

J

Joe Reiss

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
 
H

Hans

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
 
J

Joe Reiss

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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top