Skip to content

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, BR-V2-087)
  2. If the control is not found, render nothing. (BR-V2-088)

Process flow

The following diagram visualizes this operation's control flow.

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.*

Sources

  • SAIF.Presentation.Web.Controls.V2/FocusManager.vb