---
title: Prepare and render the toolbar
summary: Synchronise each toolbar icon's rendered image/access-key/tooltip from its logical button model, then render the navigation and toolbar markup in a fixed order.
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-014
trigger: "`SAIFMenuTop.OnPreRender` followed by `RenderControl` during the ASP.NET render phase."
---

# Prepare and render the toolbar

Synchronise each toolbar icon's rendered image/access-key/tooltip from its logical button model, then render the navigation and toolbar markup in a fixed order. This operation is implemented by `SAIFMenuTop.OnPreRender`, `SAIFMenuTop.RenderControl`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-014 |
| **Trigger** | `SAIFMenuTop.OnPreRender` followed by `RenderControl` during the ASP.NET render phase. |
| **Inputs** | `clsMenuButton` state per icon; `EnableButtonIndicators`; browser user agent (for Firefox detection). |
| **Outputs** | Rendered navigation and toolbar markup; client-side one-click/indicator attributes. |
| **Primary components** | `SAIFMenuTop.OnPreRender`, `SAIFMenuTop.RenderControl` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenuTop.vb` |

## Steps

1. `OnPreRender` walks the toolbar panel and, for each icon with a matching `clsMenuButton`, applies the button's image URL, access key and tooltip when they differ from the rendered values. Enforces [BR-MENU-062](../business-rules.md#br-menu-062-rendered-icon-image-access-key-and-tooltip-are-synchronised-from-the-model).
2. Tooltips gain an access-key prefix of `Alt+`, or `Shift+Alt+` when the browser is Firefox 2 or later. Enforces [BR-MENU-063](../business-rules.md#br-menu-063-access-key-tooltips-are-prefixed-for-firefox).
3. When `EnableButtonIndicators` is true, each icon enables the activity indicator and form-disable behaviour; otherwise indicators are off and one-click buttons receive an `onclick="javascript:mnuOneClickOnly(this);"` attribute. Enforces [BR-MENU-064](../business-rules.md#br-menu-064-activity-indicators-and-form-disabling-apply-to-all-toolbar-icons-together), [BR-MENU-065](../business-rules.md#br-menu-065-one-click-buttons-are-guarded-client-side-when-indicators-are-off).
4. `RenderControl` renders the navigation `div`, then — only when at least one toolbar button is visible — opens the toolbar `div`. Enforces [BR-MENU-066](../business-rules.md#br-menu-066-the-toolbar-container-renders-only-when-a-button-is-visible).
5. Render the right-hand icon span (default-submit, help, preference save/clear), each icon only when its logical button is visible, calling `DisableIcon` first when the button is disabled. Enforces [BR-MENU-067](../business-rules.md#br-menu-067-each-toolbar-icon-renders-only-when-its-button-is-visible), [BR-MENU-068](../business-rules.md#br-menu-068-a-disabled-button-renders-a-_d-image-variant-and-a-disabled-control).
6. Render the insert/save/delete/edit/cancel/submit group when any of them is visible, followed by the pipe separator image, then the print/preview/email/download/calculate group. Enforces [BR-MENU-069](../business-rules.md#br-menu-069-toolbar-icons-render-in-fixed-groups), [BR-MENU-070](../business-rules.md#br-menu-070-a-pipe-separator-image-renders-after-the-insertsavedelete-group).
7. - On failure: any exception during toolbar rendering is caught and its message, source and stack trace are written into the page. Enforces [BR-MENU-071](../business-rules.md#br-menu-071-rendering-failures-are-reported-in-page-rather-than-raised).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SAIFMenuTop.OnPreRender"]) --> Sync["Sync each icon's image URL, access key and tooltip from clsMenuButton"]
	Sync --> Prefix["Prefix tooltip access key with Alt+ (Shift+Alt+ for Firefox 2+)"]
	Prefix --> Indicator{EnableButtonIndicators?}
	Indicator -->|Yes| Enable["Enable activity indicator and form-disable per icon"]
	Indicator -->|No| OneClick["Add onclick=mnuOneClickOnly(this) to one-click buttons"]
	Enable --> Render["RenderControl: render navigation div"]
	OneClick --> Render
	Render --> ToolbarDiv{Any toolbar button visible?}
	ToolbarDiv -->|Yes| OpenDiv["Open toolbar div"]
	OpenDiv --> RightIcons["Render right-hand icon span (default-submit, help, pref save/clear)"]
	RightIcons --> Groups["Render insert/save/delete/edit/cancel/submit group, pipe separator, print/preview/email/download/calculate group"]
	Groups --> End(["Rendered navigation and toolbar markup"])
	Render -.->|Exception| ErrPage(["Message, source, stack trace written into page"])
```

## Failure and edge-case behavior

- Any unhandled rendering exception: caught and the message, source, and full stack trace are written directly into the page output ([BR-MENU-071](../business-rules.md#br-menu-071-rendering-failures-are-reported-in-page-rather-than-raised)) — an information-disclosure risk.

## 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`
