I have a listbox that's populated in the Page_PreRender handler:
Dim strResSQL As String
...code to build strResSQL
Dim cmdRes As New OleDbCommand(strResSQL, Con1)
Con1.Open()
Dim myResRDR As OleDbDataReader = cmdRes.ExecuteReader()
If myResRDR.HasRows = True Then
listResource.DataSource = myResRDR
listResource.DataTextField = "Expr3"
listResource.DataValueField = "GroupCode"
listResource.DataBind()
End Sub
What I want to do is populate a text box right above the list box with the item selected, so I tried the following for the list box:
txtBox.Text = list.SelectedItem.ToString()
The above code only populates the listbox's first item.
I do have "PostBack"=True for the listbox
Dim strResSQL As String
...code to build strResSQL
Dim cmdRes As New OleDbCommand(strResSQL, Con1)
Con1.Open()
Dim myResRDR As OleDbDataReader = cmdRes.ExecuteReader()
If myResRDR.HasRows = True Then
listResource.DataSource = myResRDR
listResource.DataTextField = "Expr3"
listResource.DataValueField = "GroupCode"
listResource.DataBind()
End Sub
What I want to do is populate a text box right above the list box with the item selected, so I tried the following for the list box:
txtBox.Text = list.SelectedItem.ToString()
The above code only populates the listbox's first item.
I do have "PostBack"=True for the listbox