As always, hope this is the right group.
Very new to .net and all its glorious headaches. Using asp.net 2.0
(trying to at least) and have a problem that is frustrating. I have a
FormView setup that uses a second sqldatasource to populate a pulldown
list (CatPullDown1) within the Edit Template. That pulldown list is
set to AutoPostBack. So far, things seem to be OK. The lits populates
correctly, and on autopostback an event fires off that updates a SQL
DB. Here's the thing. I need to use the new value from the pulldown
list to flesh out the SQL statement. I have no idea how to get that
value. Here's what fires off on that postback...
Sub CatPullDown1_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs)
DataBind()
Dim strItem As New Long
strItem = CLng(Request.QueryString("item"))
Dim strCat1Value As String
strCat1Value = CatPullDown1.SelectedItem.Value()
Dim updateCatDB1 As New SqlDataSource
updateCatDB1.ProviderName = "System.Data.SqlClient"
updateCatDB1.ConnectionString = "blah blah"
updateCatDB1.UpdateCommand = "UPDATE dbo.table Set fldCat1 = '"
& strCat1Value & "', fldCat2 = '2 ', fldCat3 = '3 ' WHERE fldItem =" &
strItem
updateCatDB1.Update()
End Sub
The strCat1Value is what I need to fill in. If I put in a specific
value (i.e. '1 ') it runs fine. The above code gives me an error that
CarPulLDown1 is not declared. It seems that it's hiding in the Edit
Template too far, but I really need to get this value out. Any help
would be great.