listbox driving a formview

M

mosscliffe

I am trying to set up a listbox as a selector for a formview

The listbox gets its data from an sql table, which is the same table
that is to be used in the formview.

For testing I have also used a details view.

It all works with the details view, but nothing appears in the
formview.

I admit I do not understand all these different properties and methods
but I think I need a formview, because I want the option to edit and
insert records.

My code is

Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
lblDropDown.Visible = True
lblDropDown.Text = "RecnoID: " &
ListBox1.SelectedValue.ToString & " " & ListBox1.SelectedItem.Text

Dim myConn As String =
System.Web.Configuration.WebConfigurationManager.ConnectionStrings("Connect_PPLISTS").ConnectionString

Dim strQuery As String = "Select * from lsts0_All where
__rowid='"
strQuery += ListBox1.SelectedValue & "'"
Response.Write(strQuery & "<BR />")
'Dim adapter As SqlDataAdapter = New SqlDataAdapter(strQuery,
myConn)
Dim adapter As New SqlDataAdapter(strQuery, myConn)

Dim dt As New DataTable("lsts0_All")

adapter.Fill(dt)
fmvDetails.DataSource = dt
fmvDetails.DataBind()
dtlDetails.DataSource = dt
dtlDetails.DataBind()


End Sub


Any help gratefully appreciated as I want to go to bed shortly

Midnight UK time

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top