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

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top