Groups | Blog | Home
all groups > asp.net > may 2005 >

asp.net : get the selected item of a DropDownList



Eranga
5/30/2005 10:03:00 PM


I want to get the selected item of a DropDownList. Is
DropDownList1.SelectedIndex the only way of doing this. It seems
ineficient to get a number and later compare it and get the string.
Please some one help me.
Thanks in advance.

Mona
5/31/2005 12:00:00 AM
Hi Eranga,

Basically, SelectedIndex property is the only way to get the selected =
item of a DropDownList.
However, instead of retrieving the index first and then getting the =
string, you can straight away get=20
the value by using the following code:

Me.ddlLocation.Items(Me.ddlLocation.SelectedIndex).Value

HTH

Mona[Grapecity]


[quoted text, click to view]
Eliyahu Goldin
5/31/2005 11:04:15 AM
DropDownList1.SelectedItem

Eliyahu

[quoted text, click to view]

Jurgen_O
6/1/2005 12:30:06 AM
You can use _ddl.SelectedValue

[quoted text, click to view]
AddThis Social Bookmark Button