'''
''' Override the CommitTransaction, retrieve the id of the
''' saved record and store it in session.
'''
Public Overrides Sub CommitTransaction(ByVal sender As Object)
' Call MyBase.CommitTransaction()which will save the changes made by user
MyBase.CommitTransaction(sender)
Dim myButton As System.Web.UI.WebControls.LinkButton = CType(sender, System.Web.UI.WebControls.LinkButton)
' Check to see if the button that got clicked is the save button.
' This is done because ID of a record should be stored
' in session only if save button is clicked.
If (myButton.Parent.ID = "${Button Control}") Then
' Store the ID in session
Me.Page.Session("UpdatedRecordID") = Me.${Table}RecordControl.GetRecord.${Primary Key}.ToString()
' Store other fields if required
' Me.Page.Session("UpdatedRecordName") = Me.${Table}RecordControl.GetRecord.${FieldName}.ToString()
End If
End Sub
|