Render top toolbar menu¶
This operation renders the SAIFMenuTop top toolbar — a row of category-scoped navigation links plus a group of CRUD/print/help/preference action icons — deriving default button visibility, enabled state, and tooltips from the current page's menu-authorization metadata.
| Field | Value |
|---|---|
| Operation ID | OP-MENU-002 |
| Trigger | ASP.NET page lifecycle events (OnInit, Page_PreLoad, CreateChildControls, OnPreRender, RenderControl) fired when a SAIFMenuTop control instance is present on a ViewPageBase-derived page |
| Inputs | Session-cached NavigationContext, SelectedCategory, per-button clsMenuButton state in ViewState, current page's clsMenuAuthorizedItem (CurrentPage), browser capabilities (Firefox detection for access-key prefix) |
| Outputs | Rendered category link row, icon toolbar (Insert/Save/Delete/Edit/Cancel/Submit/Print/Preview/Email/Download/Calculate/Help/Prefs); MenuNavigate, ToolbarClick, DefaultOnSubmit events |
| Primary components | SAIFMenuTop.OnInit, SAIFMenuTop.Page_PreLoad, SAIFMenuTop.CreateChildControls, SAIFMenuTop.OnPreRender, SAIFMenuTop.RenderControl, SAIFMenuTop.LinkButtonClick, SAIFMenuTop.NavigateToItem, SAIFMenuTop.MenuImage_Click, SAIFMenuTop.GetGrids |
| Entry point | SAIF.Presentation.Web.Controls.V2.Menu\SAIFMenuTop.vb |
Steps¶
OnInitresolvesm_PageasViewPageBase(SAIF.Presentation.Web.MVC).Page_PreLoad(event) on first load:- If
CurrentPageis not yet cached, retrieves it viaNavigationData.GetCurrentPage(). - When found and not a postback: sets each relevant button's
Visible/Enabledfrom the current page'sIsDisplayInsert/IsDisplaySave/IsDisplayDelete/IsDisplayPrint/IsDisplayDownload/IsDisplaySavePreferences/IsDisplayHelpflags (sourced fromclsMenuAuthorizedItem, external to this library), and copies per-page tooltip text (PrintToolTip,InsertToolTip, etc.). - Calls
BuildClientOneClickJavascript()to register the one-click-guard script/flag once per page. CreateChildControls:- Builds the top-of-page category link collection (
BuildLinkCollection, sorted byMenuOrder, filtered toAppItemsByCategory(SelectedCategory)andItem.IsVisible). - Builds the full icon toolbar (
BuildMenuIcons), creating oneSAIFImageButtonper action (default-submit, help, set/clear-prefs, insert, save, submit, edit, delete, cancel, print, preview, email, download, calculate), each registered inm_MenuButtonskeyed by control ID and wired to a sharedMenuImage_Clickhandler. - Scans the page control tree via
GetGridsfor any control whose type name contains"ULTRAWEBGRID".- If any are found: registers a page-level
EndEdits()JavaScript function and wires every toolbar button'sonclick(except the hidden default-submit button) to call it before postback, ensuring an open Infragistics grid cell edit is committed prior to a toolbar action.
- If any are found: registers a page-level
OnPreRender— for each renderedSAIFImageButton:- Looks up its
clsMenuButtonstate and synchronizesImageUrl,AccessKey, andToolTip(prefixing the access-key hint, e.g."Alt+I to Insert", or"Shift+Alt+I to Insert"on Firefox >= v2) from the button model. - If
EnableButtonIndicatorsis false and the button is flaggedOneClick: attaches amnuOneClickOnly(this)client-side guard to theonclick. RenderControl:- Renders the navigation
Panel. - If any toolbar button group is visible, renders the toolbar: right-icon group (Help, Set/Clear-Preferences) always inside a
<span class="righticons">; Insert/Save/Delete/Edit/Cancel/Submit group (with a "pipe" separator image) shown only ifShowInsertSaveDelete; Print/Preview/Email/Download/Calculate group shown only ifShowPrintDownload. - Each individual button renders only if its model's
Visibleis true, and is disabled visually (DisableIcon, swapping the image filename to a_d"disabled" variant and settingEnabled = False) if its model'sEnabledis false. - On failure: wrapped in
Try/Catchthat writes exception details directly to the output writer*. - User interaction — clicking a category/page link (
LinkButtonClick): - Raises
MenuNavigate("", "Help")directly for the literal"mnuHelp"control ID. - Otherwise parses the item sequence and calls
NavigateToItem, which looks up the siblingSAIFMenu1control on the page (if present) to snapshot itsContextValueintoSession("CVTextBox" & ViewID), then raisesMenuNavigate(ApplicationPath, PageLink). - User interaction — clicking any toolbar icon (
MenuImage_Click): - Raises the corresponding
ToolbarClick(ToolBarButton)event (e.g.,Insert,Save,Delete,Edit,Cancel,Submit,Print,Preview,Email,Download,Calculate,Help,PrefsSet,PrefsClear) for the host page to handle. - No business rule, SQL, or table reference is enforced or touched directly in this control — button visibility/enablement is driven entirely by flags sourced from the external
clsMenuAuthorizedItemobject**.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Page lifecycle: OnInit]) --> PreLoad[Page_PreLoad: resolve CurrentPage, apply button Visible/Enabled from clsMenuAuthorizedItem]
PreLoad --> Create[CreateChildControls: build category links and icon toolbar]
Create --> GridScan{UltraWebGrid found on page?}
GridScan -->|Yes| WireEndEdits[Wire onclick handlers to call EndEdits before postback]
GridScan -->|No| PreRender
WireEndEdits --> PreRender[OnPreRender: sync ImageUrl/AccessKey/ToolTip per button model]
PreRender --> Render[RenderControl: render category row and icon groups]
Render --> D{User interaction?}
D -->|Click category/page link| Nav[NavigateToItem: snapshot SAIFMenu1 context, raise MenuNavigate]
D -->|Click toolbar icon| Toolbar[MenuImage_Click: raise ToolbarClick event]
D -->|No interaction| EndOk([Render complete])
Failure and edge-case behavior¶
RenderControlexceptions are caught and written directly into the HTML output stream (message/source/stack trace) rather than logged or suppressed, a potential information-disclosure risk in production*.- Toolbar button groups (Insert/Save/Delete/Edit/Cancel/Submit and Print/Preview/Email/Download/Calculate) render only when their respective
ShowInsertSaveDelete/ShowPrintDownloadflags are true; otherwise the entire group is omitted. - A disabled button (
Enabled = Falseon itsclsMenuButtonmodel) is rendered with a_d"disabled" image variant rather than being hidden. - UI behavior note — disabled icon rendering:
DisableIconswaps in the_ddisabled image variant and setsEnabled = Falseon the renderedSAIFImageButtoninstead of hiding the icon, preserving toolbar layout; this is a presentational default, not a business rule.
Related documentation¶
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