///
/// Override the CommitTransaction, retrieve the id of the
/// saved record and store it in session.
///
public override void CommitTransaction(object sender)
{
// Call base.CommitTransaction()which will save the changes made by user
base.CommitTransaction(sender);
System.Web.UI.WebControls.LinkButton myButton = ((System.Web.UI.WebControls.LinkButton)(sender));
// 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}"))
{
// Save information in a session
// Store the ID in session
this.Page.Session["UpdatedRecordID"] = this.${Table}RecordControl.GetRecord().${Primary Key}.ToString();
// Save other fields in session
// this.Page.Session["UpdatedRecordName"] = this.${Table}RecordControl.GetRecord().${FieldName}.ToString();
}
}
|