Dropdownlist selected value

K

KT

I'm trying to simply get the selected value from a dropdownlist but it only
returns the first item regardless of what you select.

Dim SalutationSelected As Integer =
CInt(Me.ddlSalutationList.SelectedItem.Value)

Thanks
 
P

Phil H

KT said:
I'm trying to simply get the selected value from a dropdownlist but it only
returns the first item regardless of what you select.

Dim SalutationSelected As Integer =
CInt(Me.ddlSalutationList.SelectedItem.Value)

Thanks

Have you tried using the SelectedValue property? It does exist.

The code you are using looks as though it should work but the Cint
function isn't necessary. So long as the value is a valid numeric
string it will cast automatically. The 'Me.' qualifier isn't necessary
either.

Hence the following should work:

Dim SalutationSelected as Integer = ddlSalutationList.SelectedValue

Hope that helps

Phil Hall
 

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

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top