Thursday, March 22, 2012

Text value of Dropdown.

How do you get the selected text of a dropdown box? Selectedvalue will get
you the value and selectedindex will get you the position, but how do you
get the text (it isn't selectedText).

Thanks,

TomHi tshad,

Try this:

yourDropDownList.SelectecItem.Text

Guillermo G.

------------------------
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4

"tshad" <tscheiderich@.ftsolutions.com> wrote in message news:OlXi9QVkFHA.1464@.TK2MSFTNGP14.phx.gbl...
How do you get the selected text of a dropdown box? Selectedvalue will get
you the value and selectedindex will get you the position, but how do you
get the text (it isn't selectedText).

Thanks,

Tom
d1.SelectedItem.Text;

"tshad" wrote:

> How do you get the selected text of a dropdown box? Selectedvalue will get
> you the value and selectedindex will get you the position, but how do you
> get the text (it isn't selectedText).
> Thanks,
> Tom
>
Is DropDownList.SelectedItem.Value what you're looking for?

-Brock
DevelopMentor
http://staff.develop.com/ballen

> How do you get the selected text of a dropdown box? Selectedvalue
> will get you the value and selectedindex will get you the position,
> but how do you get the text (it isn't selectedText).
> Thanks,
> Tom
> Is DropDownList.SelectedItem.Value what you're looking for?

Oh! Indeed, DropDownList.SelectedItem.Text is what you're after. :S

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi tshad,

Try this:

yourDropDownList.SelectecItem.Text

Guillermo G.

------------------------
Guillermo Gonzlez Arroyave :: MCP ASP.Net C# :: DCE4

"tshad" <tscheiderich@.ftsolutions.com> wrote in message news:OlXi9QVkFHA.1464@.TK2MSFTNGP14.phx.gbl...
How do you get the selected text of a dropdown box? Selectedvalue will get
you the value and selectedindex will get you the position, but how do you
get the text (it isn't selectedText).

Thanks,

Tom
d1.SelectedItem.Text;

"tshad" wrote:

> How do you get the selected text of a dropdown box? Selectedvalue will get
> you the value and selectedindex will get you the position, but how do you
> get the text (it isn't selectedText).
> Thanks,
> Tom
>
Is DropDownList.SelectedItem.Value what you're looking for?

-Brock
DevelopMentor
http://staff.develop.com/ballen

> How do you get the selected text of a dropdown box? Selectedvalue
> will get you the value and selectedindex will get you the position,
> but how do you get the text (it isn't selectedText).
> Thanks,
> Tom
> Is DropDownList.SelectedItem.Value what you're looking for?

Oh! Indeed, DropDownList.SelectedItem.Text is what you're after. :S

-Brock
DevelopMentor
http://staff.develop.com/ballen
"HARI PRASD BARU" <HARIPRASDBARU@.discussions.microsoft.com> wrote in message
news:CB37336A-6424-4CF5-A175-C5F90A100150@.microsoft.com...
> d1.SelectedItem.Text;

That was it.

I can never seem to remember that when I need it.

I never understood why you have a SelectedValue, but not a SelectedText.

Thanks,

Tom
> "tshad" wrote:
>> How do you get the selected text of a dropdown box? Selectedvalue will
>> get
>> you the value and selectedindex will get you the position, but how do you
>> get the text (it isn't selectedText).
>>
>> Thanks,
>>
>> Tom
>>
>>
>

0 comments:

Post a Comment