---
title: Derive toolbar button visibility from the current page
summary: Gate each toolbar button's visibility, enabled state, and tooltip on the current authorised page's action-capability flags.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2.Menu
reference_type: package
operation_id: OP-MENU-013
trigger: "`SAIFMenuTop.Page_PreLoad`, subscribed via the `ViewPageBase.PreLoad` event."
---

# Derive toolbar button visibility from the current page

Gate each toolbar button's visibility, enabled state, and tooltip on the current authorised page's action-capability flags. This operation is implemented by `SAIFMenuTop.Page_PreLoad`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-013 |
| **Trigger** | `SAIFMenuTop.Page_PreLoad`, subscribed via the `ViewPageBase.PreLoad` event. |
| **Inputs** | `m_Page.ViewID`; `NavigationData.GetCurrentPage()`; `IsPostBack`. |
| **Outputs** | Updated `Visible`/`Enabled`/`ToolTip` on each toolbar `clsMenuButton`; registered one-click guard scripts. |
| **Primary components** | `SAIFMenuTop.Page_PreLoad` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenuTop.vb` |

## Steps

1. Capture `m_Page.ViewID`. Enforces [BR-MENU-036](../business-rules.md#br-menu-036-session-keys-are-namespaced-by-the-pages-viewid).
2. If the current page is not cached, resolve it with `NavigationData.GetCurrentPage()`. Enforces [BR-MENU-039](../business-rules.md#br-menu-039-the-current-page-is-resolved-once-and-cached-in-view-state).
   - Delegates to `NavigationContext` (which reads menu authorisation data from Oracle).
3. On a non-postback, make each toolbar button visible and enabled only when the corresponding `clsMenuAuthorizedItem` flag is set: `IsDisplayInsert`, `IsDisplaySave`, `IsDisplayDelete`, `IsDisplayPrint`, `IsDisplayDownload`, `IsDisplaySavePreferences`, `IsDisplayHelp`. Enforces [BR-MENU-059](../business-rules.md#br-menu-059-toolbar-buttons-appear-only-when-the-current-page-enables-them).
4. Copy the page-defined tooltips onto the print, insert, save, delete and download buttons. Enforces [BR-MENU-060](../business-rules.md#br-menu-060-toolbar-tooltips-are-taken-from-the-current-pages-configuration).
5. Register the one-click guard scripts (`mnuWasClicked` flag and `mnuOneClickOnly` function), each once per page. Enforces [BR-MENU-061](../business-rules.md#br-menu-061-the-one-click-guard-script-is-registered-once-per-page).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SAIFMenuTop.Page_PreLoad, subscribed via ViewPageBase"]) --> Capture["Capture m_Page.ViewID"]
	Capture --> Cache{Current page cached?}
	Cache -->|No| Resolve["NavigationData.GetCurrentPage()"]
	Cache -->|Yes| PostBack{Postback?}
	Resolve --> PostBack
	PostBack -->|No| Flags["Set Visible/Enabled from clsMenuAuthorizedItem flags"]
	Flags --> Tooltips["Copy page-defined tooltips onto toolbar buttons"]
	Tooltips --> Guard["Register one-click guard scripts once per page"]
	Guard --> End(["Updated Visible/Enabled/ToolTip on each toolbar button"])
	PostBack -->|Yes| End
```

## Failure and edge-case behavior

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

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenuTop.vb`
