Skip to content

Cascading dropdown data bind

This operation runs when a consuming page or control calls DataBind() on a clsDropDownController instance (typically during grid setup), binding two UltraGridColumn value lists and registering the generated client-side cascading-filter script.

Field Value
Operation ID OP-DROPDOWN-DATABIND
Trigger Explicit call from a consuming page/control, or ASP.NET data-binding cascade if the control is added to a naming container that calls DataBind()
Inputs Column1, Column2 (grid columns), List1, List2 (data sources), List1Code/List1Display/List2Code/List2Display/List2Key (property-name selectors)
Outputs Populated Column1.ValueList/Column2.ValueList, registered client script block "DD", populated l1/l2 collections
Primary components clsDropDownController.DataBind
Entry point SAIF.Presentation.Web.Controls.Infragistics103\clsDropDownController.vb

Steps

  1. Call MyBase.DataBind().
  2. Bind Column1.ValueList from List1 using List1Display/List1Code as display/value members; bind Column2.ValueList from List2 using List2Display/List2Code.
  3. Set Column1.Band.Grid.DisplayLayout.ClientSideEvents.BeforeEnterEditModeHandler = "BeforeEdit" & Column2.Key — wires a client-side hook so entering edit mode on Column2 triggers the generated JS filter function (BR-5).
  4. Iterate List1: for each item, use TypeDescriptor.GetProperties reflection to find the property matching List1Code (→ ListItem.id) and List1Display (→ ListItem.desc); only properties whose type has a TypeConverter convertible to String are read. Append each ListItem to l1.
  5. If no converter is found (converter Is Nothing): the value is silently skipped (left blank on the ListItem) — no exception is raised.
  6. Iterate List2 similarly, additionally capturing List2Key (→ ListItem.key), appending to l2.
  7. Call GenerateJavaScript() twice — once discarded, once passed to Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "DD", GenerateJavaScript()) to emit the generated client-side filter script (function name BeforeEdit + Column2.Key) into the page. See Cascading dropdown JavaScript generation for the full generated-script content and behavior.
  8. The first, discarded call is redundant/dead computation rather than commented-out code — both calls execute live code, so both are reported; the first result is simply unused.

Origin: Step 6 delegates the JavaScript-generation logic to GenerateJavaScript(), documented in full as Cascading dropdown JavaScript generation (same class, same library).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([DataBind called]) --> Base[Call MyBase.DataBind]
    Base --> BindCols[Bind Column1/Column2 ValueList from List1/List2]
    BindCols --> WireEvent[Set BeforeEnterEditModeHandler on Column1's grid]
    WireEvent --> Loop1[Iterate List1 via reflection into l1 ListItems]
    Loop1 --> Loop2[Iterate List2 via reflection into l2 ListItems]
    Loop2 --> Gen[Call GenerateJavaScript twice]
    Gen --> Register[RegisterClientScriptBlock 'DD']
    Register --> EndOk([DataBind complete])

Failure and edge-case behavior

  • No TypeConverter found for a reflected property: the corresponding ListItem field (id/desc/key) is silently left blank; no exception is raised.

Sources

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