Skip to content

SAIFWebDateTimeEdit null-date suppression

This operation runs during the Init phase of the ASP.NET page lifecycle for a SAIFWebDateTimeEdit control, registering a client script that blanks the field when it shows one of Infragistics' sentinel "no date" values on focus.

Field Value
Operation ID OP-DATEEDIT-INIT
Trigger ASP.NET Init event of SAIFWebDateTimeEdit
Inputs None beyond the control's own rendered text
Outputs Registered client script SDTE_Focus, an onfocus attribute on the control
Primary components SAIFWebDateTimeEdit.SAIFWebDateTimeEdit_Init
Entry point SAIF.Presentation.Web.Controls.Infragistics103\SAIFWebDateTimeEdit.vb

Steps

  1. Build inline JS function SAIFWebDateTimeEdit_Focus(inEditId) that looks up the Infragistics client-side edit object (igedit_getById), reads its .text, and if it equals the literal sentinel strings "01/01/1901" or "12/31/9999", calls oEdit.setValue(null) to blank the field (BR-1).
  2. Register the script under key "SDTE_Focus" if not already registered.
  3. The registration is checked twice — the second check is redundant/dead-code-equivalent since the condition and body are identical to the first, but both are live code, not commented out.
  4. Add an onfocus attribute to the rendered control invoking SAIFWebDateTimeEdit_Focus('{ClientID}').

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Init event fires]) --> CheckReg{SDTE_Focus already registered?}
    CheckReg -->|No| Register[Register SAIFWebDateTimeEdit_Focus script]
    CheckReg -->|Yes| Attr
    Register --> Attr[Add onfocus attribute invoking function with ClientID]
    Attr --> EndOk([Init complete])

Failure and edge-case behavior

  • If the field's displayed text is not one of the two sentinel strings, the client script takes no action and the field's value is left unchanged.

Sources

  • SAIF.Presentation.Web.Controls.Infragistics103\SAIFWebDateTimeEdit.vb