Cache, Cookies and Session Variables
Save Information in Session Variable

Description
This customization demonstrates how to save information in a session variable when updating a record.
Variables
Button Control
Select the Save button
Table
Select the table
Primary Key
Select primary key column in the record control class
Applies to
Page class
Code
 
''' 
''' 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          



     


  Privacy Statement