Skip to content

Cascade grid drop-down value lists

This operation binds two UltraWebGrid columns' value lists from consumer-supplied data sources, projects both sources into flattened lookup items, and registers the client script that filters the child column's options based on the parent column's selected value.

Field Value
Operation ID OP-01
Trigger Consuming page calls DataBind() on the control (directly or via page-level DataBind)
Inputs Column1, Column2, List1, List2, List1Code, List1Display, List2Code, List2Display, List2Key
Outputs Bound ValueList on both grid columns; populated l1/l2; a registered client script block named DD
Primary components clsDropDownController.DataBind
Entry point SAIF.Presentation.Web.Controls.Infragistics111/clsDropDownController.vb

Steps

  1. Call MyBase.DataBind() to run the standard Control data-binding pass.
  2. On failure: errors propagate from the base implementation.
  3. Assign List1 to Column1.ValueList.DataSource and set DisplayMember/ValueMember from List1Display/List1Code, then call Column1.ValueList.DataBind() (BR-CTL-004).
  4. On failure: an unset Column1 raises a NullReferenceException — no guard exists.
  5. Repeat step 2 for Column2 using List2, List2Display, List2Code (BR-CTL-004).
  6. On failure: same failure mode as step 2, for Column2.
  7. Set Column1.Band.Grid.DisplayLayout.ClientSideEvents.BeforeEnterEditModeHandler to "BeforeEdit" & Column2.Key, wiring the generated function into the grid (BR-CTL-003).
  8. Project every item in List1 into a ListItem by reflecting over TypeDescriptor.GetProperties, copying the property matching List1Code into id and the property matching List1Display into desc, but only when the property type has a TypeConverter that can convert to System.String (BR-CTL-005). Add each projected item to l1.
  9. If a property's converter cannot target String: the property is skipped, leaving id/desc Nothing for that entry.
  10. Project every item in List2 the same way, additionally copying the property matching List2Key into key (BR-CTL-005, BR-CTL-002). Add each projected item to l2.
  11. Call Generate the cascade script and discard the result, then call it a second time and register the returned script with Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "DD", …).
  12. The first call is redundant work — the script is built twice per data-bind, with no observable side effect from the discarded call.*

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([DataBind called]) --> S1["MyBase.DataBind()"]
    S1 --> S2["Bind Column1.ValueList<br>from List1"]
    S2 --> S3["Bind Column2.ValueList<br>from List2"]
    S3 --> S4["Wire BeforeEnterEditModeHandler<br>to BeforeEdit + Column2.Key"]
    S4 --> S5["Project List1 items into l1"]
    S5 --> S6["Project List2 items into l2"]
    S6 --> S7["Generate + register<br>cascade script (DD)"]
    S7 --> EndOk([DataBind complete])

Failure and edge-case behavior

  • An unset Column1 or Column2 raises an unhandled NullReferenceException — there is no null guard before the ValueList assignments.
  • A source item whose List1Code/List1Display/List2Code/List2Display/List2Key property is not string-convertible is silently skipped rather than causing a bind failure (BR-CTL-005).

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • SAIF.Presentation.Web.Controls.Infragistics111/clsDropDownController.vb