Skip to content

Restore menu state on page pre-load

Re-establish the left menu's session-scoped state (expanded/collapsed, current page, context value) at the start of each page life cycle. This operation is implemented by SAIFMenu.Page_PreLoad.

Field Value
Operation ID OP-MENU-007
Trigger SAIFMenu.Page_PreLoad, subscribed via the ViewPageBase.PreLoad event.
Inputs m_Page.ViewID; IsPostBack; authenticated identity; stored SHOWAPPS preference; Session("CVTextBox" & ViewID).
Outputs ShowApps state; cached CurrentPage; restored ContextValue.
Primary components SAIFMenu.Page_PreLoad
Entry point SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb

Steps

  1. Capture m_Page.ViewID (or empty string when the page is not a ViewPageBase). Enforces BR-MENU-036.
  2. On a non-postback with an authenticated identity, read SHOWAPPS at PrefScope.AppLevel and set ShowApps accordingly, defaulting to expanded when the preference is absent. Enforces BR-MENU-037, BR-MENU-038.
  3. Delegates to clsPreferences (SAIF.Presentation).
  4. If the current page is not yet cached in view state, resolve it via NavigationData.GetCurrentPage(). Enforces BR-MENU-039.
  5. Delegates to NavigationContext.
  6. On a non-postback, restore the context value from Session("CVTextBox" & ViewID) when present. Enforces BR-MENU-040.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start(["SAIFMenu.Page_PreLoad, subscribed via ViewPageBase"]) --> Capture["Capture m_Page.ViewID (empty if not ViewPageBase)"]
    Capture --> PostBack{Non-postback and authenticated?}
    PostBack -->|Yes| ReadPref["Read SHOWAPPS at PrefScope.AppLevel, default expanded"]
    ReadPref --> Restore["Restore context value from Session("CVTextBox" & ViewID)"]
    PostBack -->|No| Cached{Current page cached in view state?}
    Restore --> Cached
    Cached -->|No| Resolve["NavigationData.GetCurrentPage()"]
    Cached -->|Yes| End(["ShowApps state; cached current page; restored context"])
    Resolve --> End

Failure and edge-case behavior

  • No exceptional failure paths beyond those noted in the steps above.

Sources

  • SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb