---
title: Build top page links
summary: Render the top row of page links for the currently selected category, trimmed to authorised, visible 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-012
trigger: "`SAIFMenuTop.BuildLinkCollection`, invoked from [Build the top menu and toolbar](build-the-top-menu-and-toolbar.md)."
---

# Build top page links

Render the top row of page links for the currently selected category, trimmed to authorised, visible items. This operation is implemented by `SAIFMenuTop.BuildLinkCollection`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-012 |
| **Trigger** | `SAIFMenuTop.BuildLinkCollection`, invoked from [Build the top menu and toolbar](build-the-top-menu-and-toolbar.md). |
| **Inputs** | `NavigationData.MenuAuthorizedItems.AppItemsByCategory(SelectedCategory)`. |
| **Outputs** | One `LinkButton` (`top_LB<MenuItemSeqNum>`) per visible item. |
| **Primary components** | `SAIFMenuTop.BuildLinkCollection` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenuTop.vb` |

## Steps

1. In design mode, emit three placeholder links (`Page 1`–`3`). Enforces [BR-MENU-055](../business-rules.md#br-menu-055-design-mode-shows-placeholder-page-links).
2. At run time, sort authorised items by `MenuOrder`, then iterate `MenuAuthorizedItems.AppItemsByCategory(SelectedCategory)`. Enforces [BR-MENU-056](../business-rules.md#br-menu-056-top-links-show-only-the-currently-selected-category).
   - Delegates to `SAIF.Business.Menu`.
3. Create a `LinkButton` `top_LB<MenuItemSeqNum>` for each visible item, wired to `LinkButtonClick`, styled `TopMenuApp-rowSelected` when it matches the current item. Enforces [BR-MENU-057](../business-rules.md#br-menu-057-top-link-ids-are-prefixed-top_lb-plus-the-sequence-number), [BR-MENU-058](../business-rules.md#br-menu-058-the-current-pages-top-link-is-highlighted).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SAIFMenuTop.BuildLinkCollection"]) --> Design{Design mode?}
	Design -->|Yes| Placeholders(["Emit placeholder links Page 1-3"])
	Design -->|No| Sort["Sort authorised items by MenuOrder"]
	Sort --> Iterate["Iterate MenuAuthorizedItems.AppItemsByCategory(SelectedCategory)"]
	Iterate --> Create["Create LinkButton top_LB&lt;MenuItemSeqNum&gt; per visible item"]
	Create --> Wire["Wire to LinkButtonClick"]
	Wire --> Style["Style TopMenuApp-rowSelected when matching current item"]
	Style --> End(["One LinkButton per visible item"])
```

## Failure and edge-case behavior

- No exceptional failure paths beyond those noted in the steps above.

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