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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top