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¶
- Call
MyBase.DataBind(). - Bind
Column1.ValueListfromList1usingList1Display/List1Codeas display/value members; bindColumn2.ValueListfromList2usingList2Display/List2Code. - 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). - Iterate
List1: for each item, useTypeDescriptor.GetPropertiesreflection to find the property matchingList1Code(→ListItem.id) andList1Display(→ListItem.desc); only properties whose type has aTypeConverterconvertible toStringare read. Append eachListItemtol1. - If no converter is found (
converter Is Nothing): the value is silently skipped (left blank on theListItem) — no exception is raised. - Iterate
List2similarly, additionally capturingList2Key(→ListItem.key), appending tol2. - Call
GenerateJavaScript()twice — once discarded, once passed toPage.ClientScript.RegisterClientScriptBlock(Me.GetType, "DD", GenerateJavaScript())to emit the generated client-side filter script (function nameBeforeEdit+Column2.Key) into the page. See Cascading dropdown JavaScript generation for the full generated-script content and behavior. - 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
TypeConverterfound for a reflected property: the correspondingListItemfield (id/desc/key) is silently left blank; no exception is raised.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.Controls.Infragistics103\clsDropDownController.vb