Il codice che ho inserito nell' "ItemDataBound" è il seguente
Dim valore1 As String
Dim cn As New OleDb.OleDbConnection(setCnString)
If e.Item.ItemType = ListItemType.EditItem Then
Dim DRV1 As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim CurrentTipo As String = DRV1("nome")
Dim DDL1 As DropDownList = CType(e.Item.Cells(3).Controls(1), DropDownList)
Dim sqlRuolo As String = "SELECT id,nome FROM Tipo where cdruoli=" & Session("idruolo")
Dim DA1 As New OleDb.OleDbDataAdapter(sqlRuolo, cn)
Dim DS1 As New DataSet
Dim item As ListItem
DA1.Fill(DS1, "Tipo")
DDL1.DataSource = DS1.Tables("Tipo").DefaultView
DDL1.DataTextField = "Nome"
DDL1.DataValueField = "Id"
DDL1.DataBind()
item = DDL1.ItemsFindByValue(CurrentTipo)
If Not item Is Nothing Then item.Selected = True
valore1 = DDL1.SelectedItem.Value.ToString
End IfDovrei dunque inserire un DDL1.autopostback=true dopo il DDL1.databind() e poi replicare lo stesso codice nello stesso evento avendo cura di costruire la query per l'estrazione dei dati in base al valore di DDL1, vero?
Scusa se ti sto ponendo troppe domande ma mi son avvicinato da neanche due mesi al mondo asp.net...