---
title: Set client-side focus
summary: Registers control-type-specific client script that focuses (and optionally selects) a target control.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Core.Infragistics111
reference_type: package
operation_id: OP-CORE-010
trigger: Master page PreRender, or explicit use of NavigationManager
---

# Set client-side focus

This operation places client-side keyboard focus on a designated control after page load, adapting the JavaScript selector to the control's runtime type because Infragistics editors render nested input elements rather than a single focusable DOM node.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CORE-010 |
| **Trigger** | Master page `PreRender`, or explicit use of `NavigationManager` |
| **Inputs** | `FocusControl` property; `Session("focuscontrol")` |
| **Outputs** | Registered startup script that focuses (and optionally selects) the target control |
| **Primary components** | `AppViewMasterPageBase.RenderClientScripts`, `AppViewMasterPageBase.RegisterFocusControlScript`, `AppViewMasterPageBase.NavigationManager` |
| **Entry point** | `SAIF.Presentation.Web.Core.Infragistics111/AppViewMasterPageBase.vb` |

## Steps

1. On `PreRender`, check whether `FocusControl` is set.
   - If `FocusControl` is `Nothing`: exit immediately with no script registered. ([BR-CORE-028](../business-rules.md#br-core-028-no-focus-script-is-emitted-when-the-master-page-has-no-focus-control))
2. Branch on the control's runtime type name to pick the correct client-side selector: ([BR-CORE-029](../business-rules.md#br-core-029-client-side-focus-targeting-is-control-type-specific-because-infragistics-editors-render-nested-input-elements))
   - Infragistics `WebDataInput`: use the `#igtxt<ClientID>` element.
   - `WebCombo`: use `<ClientID with _ → x>_input`.
   - `WebSchedule.WebDateChooser`: use `<ClientID>_input`.
   - `Button`: focus without selecting.
   - `Infragistics.Web.UI.ListControls`: produce no script.
   - Any other type: fall back to `#<ClientID>`.
3. Wrap the selector call in `try{setTimeout(function(){…}, 100);}catch(e){}` and register it as the `FocusControl` startup script. ([BR-CORE-030](../business-rules.md#br-core-030-focus-is-applied-100-ms-after-load-inside-a-trycatch-so-a-missing-element-never-breaks-the-page))
   - On failure (element missing from the rendered DOM): the `catch(e){}` silently absorbs the error; the page continues to render normally.
4. As an alternative path, `NavigationManager` provides a session-backed mechanism:
   - Setting `BoundControlId` classifies the control, mapping `SAIFMENU` to the `CVTextBox` context box. ([BR-CORE-031](../business-rules.md#br-core-031-the-saifmenu-controls-focus-target-is-redirected-to-the-cvtextbox-context-box))
   - The derived ID is stored in `Session("focuscontrol")`.
   - `GenerateScripts` emits the matching legacy Infragistics `igdrp_` / `igcmbo_` / `igedit_` focus (and optional select) calls.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Master PreRender]) --> D1{FocusControl set?}
	D1 -->|No| EndNone([No script registered])
	D1 -->|Yes| S1[Determine control type]
	S1 --> S2[Build type-specific client selector]
	S2 --> S3[Wrap in try/setTimeout/catch, register startup script]
	S3 --> EndOk([Focus applied 100ms after load])
	Start2([NavigationManager.BoundControlId set]) --> N1{Control is SAIFMENU?}
	N1 -->|Yes| N2[Redirect to CVTextBox]
	N1 -->|No| N3[Classify control normally]
	N2 --> N4[Store ID in Session focuscontrol]
	N3 --> N4
	N4 --> N5[GenerateScripts emits igdrp_/igcmbo_/igedit_ calls]
```

## Failure and edge-case behavior
- A missing DOM element at focus time never breaks the page — the client-side `catch(e){}` absorbs the error silently. ([BR-CORE-030](../business-rules.md#br-core-030-focus-is-applied-100-ms-after-load-inside-a-trycatch-so-a-missing-element-never-breaks-the-page))
- `Infragistics.Web.UI.ListControls` types produce no focus script at all — focus silently does not occur for those controls.

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

## Sources
- `SAIF.Presentation.Web.Core.Infragistics111/AppViewMasterPageBase.vb`
