Il codice che ho usato io funziona ed è il seguente:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim strConn As String
strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("login.mdb")
Dim strSQL As String = "select titolo, codice from categorie"
Dim MyConnection As New OleDbConnection(strConn)
Dim Comm As OleDbCommand = New OleDbCommand(strSQL, MyConnection Comm.CommandType = CommandType.Text
Dim DA As OleDbDataAdapter = New OleDbDataAdapter()
DA.SelectCommand = Comm
Dim DS As New DataSet()
DA.Fill(DS, "categorie")
Dim DV As New DataView(DS.Tables("categorie"))
Puoi definire le proprietà sia nel codice che nel controllo stesso all'interno della pagina
'DDL.DataTextField= "titolo"
'DDL.DataValueField = "codice"
DDL.DataSource = DV
DDL.DataBind()
End If
End Sub
********************************
<asp:dropdownlist DataTextField="titolo" id="DDL" style="Z-INDEX: 101; LEFT: 267px; POSITION: absolute; TOP: 192px" Runat="server" AutoPostBack="false" Height="27px" Width="263px" EnableViewState="true" />
****************************************
Usando if Not Ispostback eviti che l'item del dropdownlist torni sempre a quello corrispondente all'indice (0).
Spero di esserti stato utile
Elliot