473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Get Value From FormView on Postback

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.

Nov 21 '05 #1
2 5267
Jason,

Did you know that for aspnet 2.0 are special newsgroups.

http://communities.microsoft.com/new...idbey&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.

Cor

<ja********@gmail.com>
..
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.

Nov 21 '05 #2

Cor Ligthert wrote:
Jason,

Did you know that for aspnet 2.0 are special newsgroups.

http://communities.microsoft.com/new...idbey&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.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason K | last post by:
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...
1
by: sck10 | last post by:
Hello, When using a FormView, DetailsView or GridView, how do you capture the cancel event when you are in the insert/update mode. I have a formview that I need to hide if the person clicks on...
5
by: Jurgen Appelo | last post by:
I'm at a loss here... My FormView control automatically performs a databind at each postback on the server. But in some cases I don't want this to happen. Like when the business layer decides that...
2
by: Dabbler | last post by:
What's the best way to return to GridView after editing a detail record in a FormView so the GridView shows the page with the edited record on it? I'm using GridView with standard...
2
by: flodpanter | last post by:
I have one objectdatasource which both a gridview and a formview rely on. In my Gridview I have a command button which should display the selected row in my formview. Sorting the gridview...
4
by: J055 | last post by:
Hi I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both buttons to update the data source but the 'OK' button should redirect afterwards. I can see which button is clicked...
4
by: TS | last post by:
In my production exceptions i get an email with all the form elements and their values to debug. the controls that have a blank value are not seen and it makes my debug job harder (was the...
1
by: Q. John Chen | last post by:
I have Validation controls on FormView. ClientScripts is enabled FormView's DefaultMode is ReadOnly. And I have button so it will swith to Insert or Edit mode. To be specific, I have a...
3
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText"...
5
by: Mark Olbert | last post by:
It appears that FormView controls require the >>exact<< same layout of controls and control types in the various templates in order to function properly. Failure to do so results in a "failure to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.