---
title: Render the applications accordion
summary: Build the collapsible, per-category applications accordion trimmed to the user's authorised, visible menu items.
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-005
trigger: "`SAIFMenu.AddLinks`, invoked from `CreateControls` during `OnLoad`, and again when the applications section is expanded."
---

# Render the applications accordion

Build the collapsible, per-category applications accordion trimmed to the user's authorised, visible menu items. This operation is implemented by `SAIFMenu.AddLinks`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-005 |
| **Trigger** | `SAIFMenu.AddLinks`, invoked from `CreateControls` during `OnLoad`, and again when the applications section is expanded. |
| **Inputs** | `ShowApps`; `NavigationData.MenuAuthorizedItems`; `SelectedCategory`. |
| **Outputs** | An `AjaxControlToolkit.Accordion` (`UMenu`) with one pane per category and a `LinkButton` per visible item. |
| **Primary components** | `SAIFMenu.AddLinks` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb` |

## Steps

1. When `ShowApps` is true, create an `AjaxControlToolkit.Accordion` (`UMenu`) 120 pixels wide with header styles `applicationitem` / `application-current`, 250 ms transition at 50 frames per second. Enforces [BR-MENU-024](../business-rules.md#br-menu-024-the-applications-list-is-a-fixed-size-timed-accordion).
2. Sort all authorised menu items by `MenuCategory` then `MenuOrder` using two `SortParm` entries and `SortMulti`. Enforces [BR-MENU-025](../business-rules.md#br-menu-025-application-items-are-ordered-by-category-then-order).
   - Delegates to `SAIF.Business.Menu`.
3. For each application item, open a new accordion pane whenever the category code changes — but only if that category contains at least one visible item. Enforces [BR-MENU-026](../business-rules.md#br-menu-026-one-accordion-pane-is-created-per-menu-category), [BR-MENU-027](../business-rules.md#br-menu-027-a-category-pane-is-created-only-when-it-has-a-visible-item).
4. Reject a pane whose ID is empty, equals `_Header`, or duplicates an existing pane, by throwing `ApplicationException("Bad Menu Pane ID: …")`. Enforces [BR-MENU-028](../business-rules.md#br-menu-028-pane-ids-must-be-non-empty-non-reserved-and-unique).
   - On failure: the exception propagates; no fallback rendering occurs.
5. For each visible item add a `LinkButton` (`<controlId>_LB<MenuItemSeqNum>`) inside a `<div class='UMenuli'>`, styled `applicationitemselected` when it is the current page and `application-submenu` otherwise. Enforces [BR-MENU-029](../business-rules.md#br-menu-029-only-isvisible-items-are-rendered-as-menu-links), [BR-MENU-030](../business-rules.md#br-menu-030-the-current-pages-application-link-is-highlighted).
6. When `SelectedCategory` is set, select the matching pane by ID. Enforces [BR-MENU-031](../business-rules.md#br-menu-031-the-accordion-opens-on-the-selected-category).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SAIFMenu.AddLinks"]) --> ShowApps{ShowApps true?}
	ShowApps -->|Yes| Create["Create AjaxControlToolkit.Accordion (UMenu), 120px, timed transition"]
	Create --> Sort["Sort authorised items by MenuCategory then MenuOrder"]
	Sort --> Panes["Open new pane per category change (only if category has a visible item)"]
	Panes --> Validate{"Pane ID empty, _Header, or duplicate?"}
	Validate -->|Yes| Throw(["Throw ApplicationException(Bad Menu Pane ID)"])
	Validate -->|No| Links["Add LinkButton per visible item inside UMenuli div"]
	Links --> StyleCurrent["Style applicationitemselected for current page"]
	StyleCurrent --> Select{SelectedCategory set?}
	Select -->|Yes| SelectPane["Select matching pane by ID"]
	Select -->|No| End(["Accordion with one pane per application"])
	SelectPane --> End
```

## Failure and edge-case behavior

- Duplicate, empty, or `_Header`-named pane IDs throw `ApplicationException` ([BR-MENU-028](../business-rules.md#br-menu-028-pane-ids-must-be-non-empty-non-reserved-and-unique)).

## 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/SAIFMenu.vb`
