---
title: SAIFMenuTop
summary: API reference for SAIFMenuTop.
status: draft
owner: SAIF documentation team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2.Menu
reference_type: package
---

# SAIFMenuTop

`SAIFMenuTop` is the top-toolbar server control for ASP.NET WebForms pages that derive from `ViewPageBase`*. It renders a row of category-scoped navigation links plus a group of CRUD/print/help/preference action icons, deriving each icon's default visibility, enabled state, and tooltip from the current page's `clsMenuAuthorizedItem` ([SAIF.Business.Menu](../../../saif-business-menu/overview.md)). It detects `UltraWebGrid` controls on the host page by scanning control-type names for `"ULTRAWEBGRID"` — deliberately avoiding a direct Infragistics assembly reference — to wire an `EndEdits()` call into toolbar clicks so open grid-cell edits commit before a toolbar action fires.

## Purpose
- Renders the top toolbar (category links plus icon buttons) and raises `ToolbarClick`/`MenuNavigate`/`DefaultOnSubmit` events for the host page to handle the actual CRUD/navigation action.
- Derives per-button visibility/enabled/tooltip defaults from the current page's registered menu-authorization metadata (`clsMenuAuthorizedItem`), so toolbar affordances match what the page is authorized to display.
- Coordinates with a sibling `SAIFMenu` control (if present) to snapshot its context value into session before raising navigation events, and coordinates with any `UltraWebGrid` on the page to commit pending cell edits before toolbar actions.

## Context
- Namespace: `SAIF.Presentation.Web.Controls.V2.Menu`
- Assembly/package: `SAIF.Presentation.Web.Controls.V2.Menu` (packaged within `SAIF.BOF.Presentation.Web.Infragistics103`)
- Implements `INamingContainer`.

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `InsertButton` | `ReadOnly Property InsertButton As clsMenuButton` | Backs the Insert icon; `Page_PreLoad` sets its `Visible`/`Enabled` from the current page's `IsDisplayInsert` flag, and `RenderControl` skips rendering the icon entirely when `Visible` is false. |
| `SaveButton` | `ReadOnly Property SaveButton As clsMenuButton` | Backs the Save icon; `Page_PreLoad` sets its `Visible`/`Enabled` from `IsDisplaySave`, consumed by `RenderControl` to decide whether the icon is emitted in the Insert/Save/Delete/Edit/Cancel/Submit group. |
| `DeleteButton` | `ReadOnly Property DeleteButton As clsMenuButton` | Backs the Delete icon; `Page_PreLoad` sets its `Visible`/`Enabled` from `IsDisplayDelete`, and `RenderControl` renders it only when `Visible` is true. |
| `EditButton` | `ReadOnly Property EditButton As clsMenuButton` | Backs the Edit icon rendered by `RenderControl` alongside Insert/Save/Delete/Cancel/Submit; visibility/enabled state is populated from the current page's authorization flags during `Page_PreLoad`. |
| `CancelButton` | `ReadOnly Property CancelButton As clsMenuButton` | Backs the Cancel icon rendered by `RenderControl` in the same button group as Insert/Save/Delete/Edit/Submit. |
| `SubmitButton` | `ReadOnly Property SubmitButton As clsMenuButton` | Backs the Submit icon rendered by `RenderControl`; clicking it raises `ToolbarClick(ToolBarButton.Submit)` for the host page to handle. |
| `PrintButton` | `ReadOnly Property PrintButton As clsMenuButton` | Backs the Print icon; `Page_PreLoad` sets its `Visible`/`Enabled` from `IsDisplayPrint`, and `RenderControl` includes it in the Print/Preview/Email/Download/Calculate group only when `Visible` is true. |
| `PreviewButton` | `ReadOnly Property PreviewButton As clsMenuButton` | Backs the Preview icon rendered by `RenderControl` in the same button group as Print/Email/Download/Calculate. |
| `EmailButton` | `ReadOnly Property EmailButton As clsMenuButton` | Backs the Email icon rendered by `RenderControl` in the same button group as Print/Preview/Download/Calculate. |
| `DownloadButton` | `ReadOnly Property DownloadButton As clsMenuButton` | Backs the Download icon; `Page_PreLoad` sets its `Visible`/`Enabled` from `IsDisplayDownload`, and `RenderControl` includes it in the Print/Preview/Email/Calculate group only when `Visible` is true. |
| `CalculateButton` | `ReadOnly Property CalculateButton As clsMenuButton` | Backs the Calculate icon rendered by `RenderControl` in the same button group as Print/Preview/Email/Download. |
| `HelpButton` | `ReadOnly Property HelpButton As clsMenuButton` | Backs the Help icon; `Page_PreLoad` sets its `Visible`/`Enabled` from `IsDisplayHelp`, and `RenderControl` renders it only when `Visible` is true. |
| `PrefsButton` | `ReadOnly Property PrefsButton As clsMenuButton` | Backs the base preferences icon rendered by `RenderControl`; `Page_PreLoad` derives its visibility from the current page's authorization flags. |
| `SetPrefsButton` | `ReadOnly Property SetPrefsButton As clsMenuButton` | Backs the "Set Preferences" icon; when clicked, `RenderControl`'s wiring causes `ToolbarClick(ToolBarButton.PrefsSet)` to be raised for the host page to persist the user's preferences via `clsPreferences`. |
| `ClearPrefsButton` | `ReadOnly Property ClearPrefsButton As clsMenuButton` | Backs the "Clear Preferences" icon; when clicked, `RenderControl`'s wiring causes `ToolbarClick(ToolBarButton.PrefsClear)` to be raised for the host page to reset the user's saved preferences. |
| `DefaultSubmitButton` | `ReadOnly Property DefaultSubmitButton As clsMenuButton` | Model for the hidden default-submit icon used to raise `DefaultOnSubmit`. |
| `MenuButtons` | `ReadOnly Property MenuButtons As List(Of clsMenuButton)` | The full collection of toolbar button models managed by this control instance. |
| `EnableButtonIndicators` | `Property EnableButtonIndicators As Boolean` | Enables the busy-indicator behavior (via `SAIFImageButton.EnableIndicator`) on rendered toolbar icons. |
| `HighlightPage` | `Property HighlightPage As String` | Identifies the current page/link to visually highlight as active in the rendered category row*. |
| `SelectedCategory` | `Property SelectedCategory As String` | Filters which category's links are shown in the top link row (`AppItemsByCategory`). |
| `MenuNavigate` | `Event MenuNavigate(ApplicationPath As String, PageLink As String)` | Raised when a category/page link is clicked, so the host page can perform the redirect. |
| `ToolbarClick` | `Event ToolbarClick(Button As ToolBarButton)` | Raised when any toolbar action icon is clicked, identifying which action (Insert/Save/Delete/etc.) was invoked. |
| `DefaultOnSubmit` | `Event DefaultOnSubmit()` | Raised when the hidden default-submit icon is clicked. |
| `getImageButton` | `Function getImageButton(button As clsMenuButton) As SAIFImageButton` | Locates and returns the existing `SAIFImageButton` child control whose `ID` matches the supplied `clsMenuButton` model's `ID` (via `FindControl`), returning `Nothing` when no matching image-button control exists. |
| `Page_PreLoad` | `Sub Page_PreLoad(sender As Object, e As System.EventArgs) Handles m_Page.PreLoad` | Handles the hosting page's `PreLoad` event: on first load, resolves `CurrentPage` from `NavigationData` and, if found, copies its `IsDisplayInsert`/`IsDisplaySave`/`IsDisplayDelete`/`IsDisplayPrint`/`IsDisplayDownload`/etc. flags into the visibility/enabled state of the corresponding toolbar button models. |
| `RenderControl` | `Public Overrides Sub RenderControl(writer As System.Web.UI.HtmlTextWriter)` | Renders the navigation panel and, if any toolbar button group is visible, the category link row and icon toolbar (right-icon group, Insert/Save/Delete/Edit/Cancel/Submit group, Print/Preview/Email/Download/Calculate group), rendering each button only when its model's `Visible` is true; wraps the call in `Try/Catch` and, on exception, writes the exception message/source/stack trace directly to the output writer instead of re-throwing*. |

## Behavioral notes
- Casts the hosting `Page` to `ViewPageBase` and subscribes to its `PreLoad` event, so the control only functions correctly on pages deriving from that base type*.
- On `PreLoad`, copies `IsDisplayInsert`/`IsDisplaySave`/`IsDisplayDelete`/`IsDisplayPrint`/`IsDisplayDownload`/`IsDisplaySavePreferences`/`IsDisplayHelp` flags and tooltip text from the current page's `clsMenuAuthorizedItem` into the corresponding button models.
- Scans the page's control tree (`GetGrids`) for any control whose type name contains `"ULTRAWEBGRID"`, and if found, wires every toolbar button's `onclick` (except the hidden default-submit icon) to call a page-level `EndEdits()` JavaScript function first — a deliberate design choice to avoid referencing the Infragistics grid assembly directly.
- Looks up a sibling `SAIFMenu1` control on the page (if present) to snapshot its `ContextValue` into session before raising `MenuNavigate`, coupling this control's runtime behavior to `SAIFMenu` when both are placed on the same page.
- Toolbar button groups (Insert/Save/Delete/Edit/Cancel/Submit and Print/Preview/Email/Download/Calculate) render only when `ShowInsertSaveDelete`/`ShowPrintDownload` are true, respectively.
- `RenderControl` wraps rendering in `Try/Catch` and writes exception message/source/stack trace directly into the HTML output stream on failure, instead of re-throwing or logging*.

## Constraints and usage notes
- Requires the hosting page to derive from `ViewPageBase` ([SAIF.Presentation.Web.MVC](../../../saif-presentation-web-mvc/overview.md)).
- When placed alongside a `SAIFMenu` control on the same page, expects that sibling control to be named/IDed `SAIFMenu1` for context-value coordination to function*.
- Intended to be dropped onto ASP.NET WebForms pages via markup rather than instantiated programmatically as a standalone service.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

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