---
title: Set initial page focus
summary: Set the browser focus to a named control when the page loads.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2
reference_type: package
operation_id: OP-V2-014
trigger: ASP.NET page lifecycle invokes `Render` on a `FocusManager` instance.
---

# Set initial page focus

Set the browser focus to a named control when the page loads. ASP.NET page lifecycle invokes `Render` on a `FocusManager` instance.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-V2-014 |
| **Trigger** | ASP.NET page lifecycle invokes `Render` on a `FocusManager` instance. |
| **Inputs** | `BoundControlId`. |
| **Outputs** | A registered startup script that focuses the bound control, or no output. |
| **Primary components** | `FocusManager` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2/FocusManager.vb` |

## Steps

1. On `Render`, if `BoundControlId` is set and the page contains a control with that ID, register a startup script that calls `.focus()` on the element inside a `try`/`catch` block. ([BR-V2-086](../business-rules.md#br-v2-086-focus-is-set-only-when-the-target-control-exists), [BR-V2-087](../business-rules.md#br-v2-087-focus-script-wrapped-in-trycatch))
2. If the control is not found, render nothing. ([BR-V2-088](../business-rules.md#br-v2-088-unresolvable-boundcontrolid-produces-no-output))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Render]) --> Set{BoundControlId set?}
	Set -->|No| NoOut([No output])
	Set -->|Yes| Found{Control exists?}
	Found -->|No| NoOut
	Found -->|Yes| Script["Register focus() startup script in try/catch"]
	Script --> Done([Rendered])
```

## Failure and edge-case behavior

- No exceptional failure handling beyond the branches described in **Steps** was found in the analysis findings.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Presentation.Web.Controls.V2/FocusManager.vb`
