Skip to content

Harvest posted control values

Gives every derived screen its posted control values without per-control wiring. This operation recognizes both standard ASP.NET controls and vendor/SAIF controls purely by their type name, so the framework takes no compile-time dependency on the vendor assemblies.

Field Value
Operation ID OP-MVC-09
Trigger Page_Load → CallRetrieve
Inputs The page's control tree
Outputs Hashtable of control values keyed by control ID, passed to the derived Retrieve
Primary components clsControllerBase.CallRetrieve → GetInControls
Entry point SAIF.Presentation.Web.MVC/clsControllerBase.vb

Steps

  1. Walk the page's control tree recursively, descending into any control that HasControls (BR-MVC-020).
  2. For each control, switch on the upper-cased type name and read its value: TextBox.Text (inside a swallowing Try), DropDownList.SelectedValue, ListBox.SelectedValue, CheckBox.Checked, RadioButton.Checked (BR-MVC-020).
  3. On failure (TextBox.Text read): the exception is swallowed and processing continues with the next control.
  4. For Infragistics editors (WEBCURRENCYEDIT, WEBDATETIMEEDIT, WEBMASKEDIT, WEBNUMERICEDIT, WEBTEXTEDIT) and WEBDATECHOOSER, read the Text property reflectively and trim it (BR-MVC-020, BR-MVC-021).
  5. For WEBCOMBO, read DisplayValue reflectively; for SAIFMENU, read ContextValue (BR-MVC-021).
  6. If a control's type name matches none of the recognized cases: the control is silently skipped and contributes no entry to the value map.
  7. Store each value in the hashtable keyed by control ID, then call the derived Retrieve(controlValues, Context.GetContext("targetView")).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([CallRetrieve]) --> S1[Walk control tree recursively]
    S1 --> S2{Recognized standard control type?}
    S2 -->|Yes| S3[Read value via type-specific property]
    S2 -->|No| S4{Recognized vendor/SAIF control?}
    S4 -->|Yes| S5[Read value reflectively]
    S4 -->|No| S6[Skip control]
    S3 --> S7[Store in hashtable keyed by control ID]
    S5 --> S7
    S6 --> S7
    S7 --> EndOk([Call derived Retrieve with control values])

Failure and edge-case behavior

  • TextBox.Text reads are wrapped in a swallowing Try, so a failure reading one text box does not abort the harvest of the remaining controls.
  • Unrecognized control types (custom or third-party controls not in the switch list) are silently ignored rather than raising an error.

Sources

  • SAIF.Presentation.Web.MVC/clsControllerBase.vb