I can’t figure out why when I reopen a batch and make changes to it after I re save it all the updates go the last record. Thank you for your help. This is my save button save event :

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
chBox.Checked = False 'uncheck

lblMessage.Text = String.Empty 'reset
objData.ACHID = txtACHID.Text 'adding the ACH

Dim dtGLDetail As DataTable
dtGLDetail = CType(ViewState("tblGLAcctDetail"), DataTable)
If IsNothing(dtGLDetail) Then
' lblMessage.Text = "Invalid GL Account Selection"
csm.RegisterClientScriptBlock(Me.GetType(), "PopupScript", "<script>alert('Invalid GL Account Selection')</script>")
Exit Sub
End If

txtOutOfBalance.Text = Convert.ToDouble(txtOutOfBalance.Text)

'validate invoice with AP Histroy table....
If txtInvoiceNumber.Text.Trim() <> String.Empty Then 'if there is no invoice no. then no need to validate from db.

If hdnPayableID.Value = "No" Then 'dnt valiate during the update mode...
Dim dtInvoiceDetail As DataTable
dtInvoiceDetail = objMethods.isInvoiceExists(ddlVendor.SelectedValue , txtInvoiceNumber.Text.Trim())

If dtInvoiceDetail.Rows.Count <> 0 Then
csm.RegisterClientScriptBlock(Me.GetType(), "PopupScript", "<script>alert('Invoice No. already exists, Please refer the Batch No. '" + dtInvoiceDetail.Rows(0)(0).ToString() + ")</script>")
lblMessage.Text = "Invoice No. already exists, Please refer the Batch No." + dtInvoiceDetail.Rows(0)(0).ToString()
Exit Sub
End If
End If
End If
If hdnPayableID.Value <> "No" Then objData.PayableID = hdnPayableID.Value 'for update purpose
' If hdnScheduleID.Value <> "No" Then objData.ScheduleID = hdnScheduleID.Value

'Multiple GL account Section

Dim objGLAcctDetail(dtGLDetail.Rows.Count) As GLMultipleAcctObject

For i = 0 To dtGLDetail.Rows.Count - 1
objGLAcctDetail(i) = New GLMultipleAcctObject

objGLAcctDetail(i).GLAccount = dtGLDetail.Rows(i)(0) 'GL Code

objGLAcctDetail(i).GLAccountDesc = dtGLDetail.Rows(i)(1) 'GL DESC

objGLAcctDetail(i).Trantype = dtGLDetail.Rows(i)(2).ToString().Substring(0, 1) 'DR / CR, either D or C
objGLAcctDetail(i).TranAmount = dtGLDetail.Rows(i)(3) 'Amount
objGLAcctDetail(i).GLAccountID = dtGLDetail.Rows(i)(4) 'Acct ID , ZERO -> insert or else update mode... SP level validation.


'' Debit account from label box....

objData.BatchID = ddlBatchDesc.SelectedValue
objData.Vendor = ddlVendor.SelectedValue
objData.ClaimNo = txtClaimNumber.Text
' objData.Desc = txtDescription.Text
objData.PayableLineID = objMethods.getPayableLineID() 'Auto generate A-Z then 0-9 again

objData.PayableGrp = "R" 'as per the document
objData.PayableSubGrp = ddlPaymenttype.SelectedValue
objData.Invoiceno = txtInvoiceNumber.Text
objData.InvoiceDate = txtInvoiceDate.Text
objData.InvoiceDesc = txtInvoiceDesc.Text
objData.InvoiceAmount = txtInvoiceAmount.Text
objData.UserID = Session("UserID")

Dim dtCounter As DataTable
' dtCounter = objMethods.getCounterNum()
dtCounter = objMethods.getCounterNum()
objData.NextCounter = Convert.ToInt32(dtCounter.Rows(0)("counter_num"))

'file upload section
Dim arrAnyFile() As String
arrAnyFile = Directory.GetFiles(Server.MapPath("~/") & "APTemp", "*.*")
Dim objFiles(arrAnyFile.Length) As PayableDataMaintenanceObjects 'Array objects to store multiple documents

btnClear.Enabled = True
Catch ex As Exception
lblMessage.Text = ex.Message
btnSave.Enabled = True
btnUploadFile.Enabled = True
End Try
End Sub