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

# SAIFMenu

`SAIFMenu` is the left-side navigation panel server control for ASP.NET WebForms pages that derive from `ViewPageBase`*. It renders a favorites link list, a collapsible application/category accordion (via `AjaxControlToolkit.Accordion`), and an optional context-value text box (e.g., a claim-number entry field), sourcing all navigable items from a session-cached `NavigationContext` backed by `clsMenuAuthorizedItem`/`clsMenuAuthorizedItemCollection` ([SAIF.Business.Menu](../../../saif-business-menu/overview.md)). It does not perform navigation itself (aside from a hard-coded "Change Password" redirect) — it raises `MenuNavigate`, `OnContextChanged`, and `DefaultOnSubmit` events for the hosting page to handle.

## Purpose
- Renders the collapsible favorites/applications navigation chrome for a WebForms page, persisting the user's expand/collapse preference via `SAIF.Presentation.clsPreferences`.
- Provides an optional context-value text box (e.g., claim number) whose value is shared with a sibling `SAIFMenuTop` control via session state.
- Raises `MenuNavigate`, `OnContextChanged`, and `DefaultOnSubmit` events so the host page performs actual navigation and business actions rather than this control.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `DisplayChangePW` | `Property DisplayChangePW As Boolean` | Controls whether the "Change Password" favorite link is rendered (in conjunction with `AppGlobal.EnvironmentService.IsClientExternal`)*. |
| `ShowApps` | `Property ShowApps As Boolean` | Tracks the current expand/collapse state of the applications accordion; persisted per-user via `clsPreferences` key `"SHOWAPPS"`. |
| `SelectedCategory` | `Property SelectedCategory As String` | Identifies which menu category is currently active, used to filter/highlight accordion content*. |
| `MaxContextValueLength` | `Property MaxContextValueLength As Integer` | Sets the maximum character length applied to the context-value text box's `MaxLength` on render. |
| `UpperCaseContextValue` | `Property UpperCaseContextValue As Boolean` | Forces the context-value text box input to upper case*. |
| `ContextViewStyle` | `Property ContextViewStyle As ContextViewStyleEnum` | Selects the render state (`Normal`/`Read_Only`/`Hidden`) of the context-value text box. |
| `ContextLabel` | `Property ContextLabel As String` | Label text displayed next to the context-value text box. |
| `ContextValue` | `Property ContextValue As String` | The current value entered in the context text box; snapshotted into session and shared with a sibling `SAIFMenuTop` before navigation events fire. |
| `DefaultSubmitButton` | `ReadOnly Property DefaultSubmitButton As SAIFMenuTop.clsMenuButton` | Returns the `clsMenuButton` registered under the `"imgDefaultOnSubmit"` key, i.e. the button associated with the default-submit icon. |
| `HighlightPage` | `Property HighlightPage As String` | Identifies the current page/link to visually highlight as active in the rendered navigation*. |
| `OnContextChanged` | `Event OnContextChanged As ContextChangedEventHandler` | Raised when the context-value text box's value changes, carrying `OldContext`/`NewContext`. |
| `MenuNavigate` | `Event MenuNavigate(ApplicationPath As String, PageLink As String)` | Raised when the user clicks a favorite/application link or presses Enter in the context box, so the host page can perform the redirect. |
| `DefaultOnSubmit` | `Event DefaultOnSubmit()` | Raised when the hidden default-submit icon is clicked, delegating default form-submit behavior to the host page. |
| `New` (constructor) | `Sub New()` | Builds the control's initial child-control tree — the padded navigation `Panel`, the context-value `TextBox` (`CVTextBox`), and the hidden "enter" `LinkButton` — and adds them to `NavDiv`. |
| `Page_PreLoad` | `Sub Page_PreLoad(sender As Object, e As System.EventArgs) Handles m_Page.PreLoad` | Handles the hosting page's `PreLoad` event: restores the `ShowApps` accordion-expansion preference from `clsPreferences` (defaulting to expanded) on first load for an authenticated user, resolves `CurrentPage` from `NavigationData`, and restores `ContextValue` from session state. |
| `getImageButton` | `Function getImageButton(inButton As SAIFMenuTop.clsMenuButton) As SAIFImageButton` | Looks up the `SAIFImageButton` child control whose `ID` matches `inButton.ID`, returning `Nothing` if no matching `SAIFImageButton` control is found. |
| `RenderControl` | `Public Overrides Sub RenderControl(writer As System.Web.UI.HtmlTextWriter)` | In non-design mode, refreshes the context-value text box's `MaxLength` from `MaxContextValueLength` and then defers to the base rendering; 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*.
- Lazily resolves and caches a `NavigationContext` in `HttpContext.Current.Session("navdata")`, keyed by the current Windows-authenticated user; this cache is shared with a sibling `SAIFMenuTop` on the same page when present.
- Clicking the "Change Password" favorite performs a direct `Response.Redirect("/BusinessOnline/Changepassword.aspx?__SAIFPID=" & ViewID)` rather than raising `MenuNavigate` — the one navigation action this control performs itself.
- `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*.
- `AddLinks` throws an `ApplicationException` if a duplicate or blank accordion pane ID is generated while building the application/category accordion.

## Constraints and usage notes
- Requires the hosting page to derive from `ViewPageBase` ([SAIF.Presentation.Web.MVC](../../../saif-presentation-web-mvc/overview.md)).
- Requires Windows/Integrated authentication (`HttpContext.Current.Request.LogonUserIdentity.Name`) to resolve the current user for navigation-data caching*.
- Depends on `AjaxControlToolkit.Accordion`/`AccordionPane` (local `..\Libs\AjaxControlToolkit.dll`) for the collapsible accordion rendering.
- Intended to be dropped onto ASP.NET WebForms pages via markup (`ToolboxData`) 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\SAIFMenu.vb`
