Hi Juanjo,
For easier debugging during development I recommend that you expand that one
line of code to be like this:
Dim ddl As DropDownList
Dim dgi As DataGridItem
dgi = CType(dgEquiArt.Items(dgEquiArt.EditItemIndex), DataGridItem)
'or if you are writing this in the method that handles the
DataGrid.EditCommand
'event use the datagrid item from the passed parameter of type
'DataGridCommandEventArgs like this:
'dgi = e.Item
ddl = dgi.FindControl("SecondDropDownListID") 'use here the ID of the
dropdownlist
If ddl Is Nothing Then
Throw New Exception("Could not find the second dropdwonlist")
Else
ddl.ClearSelection()
Dim oListItem As ListItem = ddl.Items.FindByValue("xxxx")
If Not oListItem Is Nothing Then oListItem.Selected = True
End If
--
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"Juanjo" wrote:
OK Phillip, many many thanks.
Now my 2 dropdownlists works ok, but now my problem is with the second
dropdownlist and the property selectedvalue.
I need to set this property, I try with
CType(dgEquiArt.Items(dgEquiArt.EditItemIndex).Cel ls(7).Controls(1),
DropDownList).SelectedValue="XXXXX"
in event OnSelectedIndexChanged of first dropdownlist, but causes an error
El argumento especificado está fuera del intervalo de valores válidos.
Nombre del parámetro: 4730601
In english: The argument specified is out of valid interval values.
Parameter name 4730601
Could you help me?