Get Value From FormView on Postback

  • Thread starter Thread starter jason.kunk
  • Start date Start date
J

jason.kunk

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.
 
Cor said:
Jason,

Did you know that for aspnet 2.0 are special newsgroups.

http://communities.microsoft.com/newsgroups/default.asp?icp=whidbey&slcid=us

Keep in mind that it is in beta, which means that there can be a lot of
errors which have not to be resolved in this beta version, however for which
you have to wait on the final version.

Cool, I was not aware, thanks for the heads up. Plus I have noticed
thanks to a screw-up in my posting I have already cross-posted this
item to two usenet groups. Sorry, folks.

I did know that 2.0 was in Beta, I guess I should have asked if anyone
knew if this was by design or if it was a flaw. I'll poke around the
other newsgroup to see what I can dig up.
 

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

Back
Top