protected void Page_Load(object sender, EventArgs e) { // initialize database helper objDB = new DBAccess(); objDB.ErrorLabel = lblError; btnOk.OnClientClick = string.Format("javascript: {0}.style.visibility = 'hidden'; return false; ", pnlMessage.ClientID); pnlMessage.Visible = false; if (!Page.IsPostBack) { // do the initial retrieval of the list of CADs DataTable objCADTable = objDB.GetCADs(); ddlCADId.DataSource = objCADTable; ddlCADId.DataTextField = "CAD"; ddlCADId.DataValueField = "CAD"; ddlCADId.DataBind(); } else { // retrieve table to be edited from the Session objDT = (DataTable)Session[ CACHED_TABLE ]; if (objDT != null) fvEditor.DataSource = objDT; // retrieve the item template containing the tabs and the columns to use in the formview DynamicItemTemplate objTemplate = (DynamicItemTemplate)Session[ CACHED_TEMPLATE ]; if (objTemplate != null) { fvEditor.EditItemTemplate = objTemplate; try { fvEditor.DataBind(); } catch (Exception) { } } // retrieve the table that stores the changed columns and reasons if (objChangedColumns == null) { objChangedColumns = (DataTable)Session[ CACHED_CHANGEDCOLS ]; // if it is not Sessiond, create and Session it if (objChangedColumns == null) { // if table does not exist, create it and Session the structure objChangedColumns = new DataTable("ChangedColumns"); ... Session[ CACHED_CHANGEDCOLS ] = objChangedColumns; } } // retrieve the index of the currently selected change in the list box of changes iPreviousIndex = Convert.ToInt32( Session[PREVIOUS_INDEX] ); } }