[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

SelectedIndex always -1 in DropDownList

Ramon

1/18/2003 7:48:00 PM

Hello,

I have a DropDownList in my form. The SelectedIndex=20
property of this=20
DropDownList is set by code when the page is loaded with=20
the next code:

<tr>
<td><asp:DropDownList id=3D"DropListLocalidad"=20
runat=3D"server"></asp:DropDownList></td>
</tr>
<%
DropListLocalidad.SelectedIndex =3D 1
%>

The options are binded from a data base some lines before.

When the user press the button Submit the code must check=20
the option selected (the user
could change it) and forward it. The code is:

'Elecci=F3n de Localidad
If DropListLocalidad.SelectedIndex > -1 then
If Dir_Respuesta <> "" Then Dir_Respuesta =3D=20
Dir_Respuesta & "&"
Dir_Respuesta =3D Dir_Respuesta & "Loc=3D" &=20
DropListLocalidad.SelectedItem.Text
End If

But the selected index is always -1. What's the problem?=20
What should I do?

Thnak you in advance and regards, Ram=F3n.