Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RosH - 08 Sep 2007 14:02 GMT
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.ToString, "yyyy",
Nothing)
       e.NewValues.Remove("PassOutYear")
       e.NewValues.Add("PassOutYear", PassOutDate1.ToString)

End Sub
Just Me - 08 Sep 2007 17:22 GMT
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.ToString, "yyyy",Nothing)

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

>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
[quoted text clipped - 4 lines]
> As System.Web.UI.WebControls.FormViewUpdatedEventArgs) Handles
> FormView1.ItemUpdated

> End Sub
RosH - 09 Sep 2007 06:44 GMT
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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.