public void SaveButton_Click(object sender, EventArgs args) {

      bool shouldRedirect = true;
      string TargetKey = null;
      string DFKA = TargetKey;
      string id = DFKA;
      string value = id;

      try {
        // Enclose all database retrieval/update code within a Transaction boundary
        DbUtils.StartTransaction();


        if (!this.IsPageRefresh) {
          this.SaveData();
        }

        this.CommitTransaction(sender);

        // Here is my custom code.

        TargetKey = this.Page.Request.QueryString["Target"];

        if (TargetKey != null) {

          DFKA = NetUtils.GetUrlParam(this, "DFKA", false);
          if (this.CategoriesRecordControl != null && this.CategoriesRecordControl.DataSource != null) {

            id = this.CategoriesRecordControl.DataSource.CategoryID.ToString();
            if (!String.IsNullOrEmpty(DFKA)) {
              if (DFKA.Trim().StartsWith("=")) {
                System.Collections.Generic.IDictionary<string, object> variables = new System.Collections.Generic.Dictionary<string, object>();
                variables.Add(this.CategoriesRecordControl.DataSource.TableAccess.TableDefinition.TableCodeName, this.CategoriesRecordControl.DataSource);
                value = EvaluateFormula(DFKA, this.CategoriesRecordControl.DataSource, null, variables);
              } else {
                value = this.CategoriesRecordControl.DataSource.GetValue(this.CategoriesRecordControl.DataSource.TableAccess.TableDefinition.ColumnList.GetByAnyName(DFKA)).ToString();
              }
            }

            if (value == null) {
              value = id;
            }
            string formula = this.Page.Request.QueryString["Formula"];
            if (formula != null && formula != "") {
              System.Collections.Generic.IDictionary<string, object> variables = new System.Collections.Generic.Dictionary<string, object>();
              variables.Add(this.CategoriesRecordControl.DataSource.TableAccess.TableDefinition.TableCodeName, this.CategoriesRecordControl.DataSource);
              value = EvaluateFormula(formula, this.CategoriesRecordControl.DataSource, null, variables);
            }
            BaseClasses.Utils.MiscUtils.RegisterAddButtonScript(this, TargetKey, id, value);
          }
          shouldRedirect = false;

        }

      } catch (Exception ex) {
        // Upon error, rollback the transaction
        this.RollBackTransaction(sender);
        shouldRedirect = false;
        this.ErrorOnPage = true;

        // Report the error message to the end user
        BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "BUTTON_CLICK_MESSAGE", ex.Message);

      } finally {
        DbUtils.EndTransaction();
      }
      if (shouldRedirect) {
        this.ShouldSaveControlsToSession = true;
        this.RedirectBack();
      } else if (TargetKey != null && !shouldRedirect) {
        this.ShouldSaveControlsToSession = true;
        this.CloseWindow(true);
      }

    }