Hi,

I have a page with a datagrid, and inside the data grid I want to edit with templates some columns.
In the templates I use dropdownlist to let the user to select the new value.
My questuion is where and how to set the initial selected value of the dropdownlist so it will match the value that exist for that cell.
I tried with this code, where I can get existing value in lblActive, but I don't have the Edit field (dropdownlist) available to set the initial selected field.
Which will be the proper event to do this?

Sub DataGrid1_EditCommand(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
Dim lblActive As Label
lblActive = e.Item.FindControl("lblActive")


DataGrid1.EditItemIndex = e.Item.ItemIndex
BindDataGrid()

Dim oneItem As ListItem
Dim ddlActive As DropDownList
ddlActive = e.Item.FindControl("DropDownListActive")
For Each oneItem In ddlActive.Items
If oneItem.Value.ToLower = lblActive.Text.ToLower Then
oneItem.Selected = True
End If
Next

End Sub

Thank you,

svatasoiu