473,396 Members | 2,029 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,396 software developers and data experts.

Change of new values during the (FormView_Updating) event does not work

I cannot understand what is wrong with the following code. All I want
to do is to change certain values of a DateTime column during FormView
updating event. Right now this event handler returns Null values to
the Database. Looking for expert advice.

Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.FormViewUpdatedEventArgs ) Handles
FormView1.ItemUpdated

Dim PassOutYearDDL As DropDownList =
FormView1.FindControl("PassOutYearDDL")
Dim PassOutDate1 As DateTime =
DateTime.ParseExact(PassOutYearDDL.SelectedValue.T oString, "yyyy",
Nothing)
e.NewValues.Remove("PassOutYear")
e.NewValues.Add("PassOutYear", PassOutDate1.ToString)

End Sub

Sep 8 '07 #1
2 1519
I think this only works when you are bound to a datasource. Is this the case
?
'//Your Code
#1 - Dim PassOutYearDDL As DropDownList =
FormView1.FindControl("PassOutYearDDL")
#2 - Dim PassOutDate1 As DateTime =
DateTime.ParseExact(PassOutYearDDL.SelectedValue.T oString, "yyyy",Nothing)

#4 - e.NewValues.Remove("PassOutYear")
#5 - e.NewValues.Add("PassOutYear", PassOutDate1.ToString)

"RosH" <ro***********@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
>I cannot understand what is wrong with the following code. All I want
to do is to change certain values of a DateTime column during FormView
updating event. Right now this event handler returns Null values to
the Database. Looking for expert advice.

Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.FormViewUpdatedEventArgs ) Handles
FormView1.ItemUpdated
End Sub

Sep 8 '07 #2
Thank you for the reply,

All I wanted to do is to change certain values just before update to a
database, using code. If you have any "how-to" reference of doing it,
please send me.

Sep 9 '07 #3

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

Similar topics

2
by: fish | last post by:
Hi, I have an HTML page with a FORM and some input fields. On the fields I wish to do validation as the punters change the field values. If they get it wrong, then I tell them and then wish...
1
by: Derek | last post by:
Another DGrid question... I can not access the values of a cell in a datagrid unless I make them visible. I do not want these fields displayed. I only want to use the values to run a stored...
4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
4
by: DebbieG | last post by:
I have a form based on this query: SELECT Students.LastSerDT, OtherInfo.Served, OtherInfo.HSGradYr, OtherInfo.ActivePart, OtherInfo.Served, Students.SSN, & ", " & & " " & AS Name,...
1
by: Richard Hollenbeck | last post by:
I noticed I can't push a value into a text box by saying something like, "txtThisTextBox = intSomeVariable * 0.5" because I get an run-time error saying I can't assign a value to this object....
5
by: Edward Diener | last post by:
I am gathering from the documentation that return values from __events are not illegal but are frowned upon in .NET. If this is the case, does one pass back values from an event handler via...
1
by: Tom S. | last post by:
Hello all, I have a page that contains two listboxes and an "Add" button. When clicked, the button fires javascript that moves the selected item(s) in the first listbox to the second listbox and...
3
by: Jimmy Stewart | last post by:
this will probably seem like a lame question but it is baffling me. I want to change the features if a control on a single form, i.e. the text color of a particular field if another check box is...
0
by: Dave A | last post by:
I have a user control that is dynamically loaded into a repeater; (so the user control appears several times) The user control features a text box and a delete button. When the delete button...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.