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¶
- On
PreRender, check whetherFocusControlis set. - If
FocusControlisNothing: exit immediately with no script registered. (BR-CORE-028) - Branch on the control's runtime type name to pick the correct client-side selector: (BR-CORE-029)
- 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>. - Wrap the selector call in
try{setTimeout(function(){…}, 100);}catch(e){}and register it as theFocusControlstartup script. (BR-CORE-030) - On failure (element missing from the rendered DOM): the
catch(e){}silently absorbs the error; the page continues to render normally. - As an alternative path,
NavigationManagerprovides a session-backed mechanism: - Setting
BoundControlIdclassifies the control, mappingSAIFMENUto theCVTextBoxcontext box. (BR-CORE-031) - The derived ID is stored in
Session("focuscontrol"). GenerateScriptsemits the matching legacy Infragisticsigdrp_/igcmbo_/igedit_focus (and optional select) calls.
Process flow¶
The following diagram visualizes this operation's control flow.
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) Infragistics.Web.UI.ListControlstypes produce no focus script at all — focus silently does not occur for those controls.
Related documentation¶
Sources¶
SAIF.Presentation.Web.Core.Infragistics111/AppViewMasterPageBase.vb