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:
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!
Code:
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
What should I do? What am I missed? Please give me some idea. Thanks!