Home All Groups Group Topic Archive Search About
Author
1 Dec 2006 4:33 PM
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

Author
2 Dec 2006 9:32 PM
Phil H
KT wrote:
> 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