legendgod Posted January 15, 2006 Posted January 15, 2006 Because I have customerize my DetailsView control by "edit template", I need to convert the field (it is seven checkboxlists) to a string value. So I write up some a function to handle ItemUpdating event: Sub DetailsViewUpdateing(ByVal sender As Object, ByVal Args As DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating Dim abc As DetailsView abc = sender HiddenScheduleStringA.Value = Convert24ChkBoxToString(abc.FindControl("ChkBoxListSchedule1"), abc.FindControl("ChkBoxListSchedule2"), abc.FindControl("ChkBoxListSchedule3"), abc.FindControl("ChkBoxListSchedule4"), abc.FindControl("ChkBoxListSchedule5"), abc.FindControl("ChkBoxListSchedule6"), abc.FindControl("ChkBoxListSchedule7")) Dim sName, sSchedule, sID, sNote As New Parameter sID.Name = "sID" sName.Name = "sName" sSchedule.Name = "sSchedule" sNote.Name = "sNote" sID.DefaultValue = Args.Keys("sID") sName.DefaultValue = CStr(Args.NewValues("sName")) sNote.DefaultValue = CStr(Args.NewValues("sNote")) sSchedule.DefaultValue = HiddenScheduleStringA.Value sourceShift.UpdateParameters("sSchedule") = sSchedule sourceShift.UpdateParameters("sName") = sName sourceShift.UpdateParameters("sID") = sID sourceShift.UpdateParameters("sNote") = sNote sourceShift.Update() End Sub I traced the flow with Debug tool. I found the Database do updated at the END of this function! However, it turn back to old value at the DetailsView databinding event..... What should I do? What am I missed? Please give me some idea. Thanks! Quote http://blog.legendgod.com
legendgod Posted January 26, 2006 Author Posted January 26, 2006 I found the solution! Just need to add a cancel event to stop the update event. Then the data will be updated as the code telling. Quote http://blog.legendgod.com
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.