Auto-bind an individual control to its bound object¶
AutoBindControlAncestor.DataBind()/BindToControl()/BindToObject() implement the reflection-based binding contract shared by AutoBindTextbox, AutoBindWebDateTimeEdit, and AutoBindWebMaskEdit. The control resolves its bound business-object property via a dotted-path lookup (BindSource), pushes the value into its own Value property, and — on user postback — writes edits back onto the bound object.
| Field | Value |
|---|---|
| Operation ID | OP-AJAX-002 |
| Trigger | ASP.NET control lifecycle calling DataBind() on the control (directly, or via Page-wide auto-bind and validate); or a user postback event (TextChanged/ValueChange) |
| Inputs | RootBindingObject, BindSource (dotted property path, e.g. "Submission.Locations.Primary"), BindProperty |
| Outputs | Control's Value populated from the bound business-object property; on postback, the bound object's property is updated |
| Primary components | AutoBindControlAncestor.DataBind, AutoBindControlAncestor.BindToControl, AutoBindControlAncestor.BindToObject, BindingUtility.GetObject, BindingUtility.BindValue |
| Entry point | SAIF.Presentation.Web.Controls.AJAX.Infragistics103\AutoBindControlAncestor.vb |
Steps¶
MyBase.DataBind()runs standardCompositeControldata binding.- If
RootBindingObjectisNothing, the method returns immediately — binding silently no-ops. BindToControl()is called:BindingUtility.BindValue(BoundObject, BindProperty, Me, "Value")reads the named property off the resolvedBoundObject(itself resolved viaBindingUtility.GetObject(RootBindingObject, BindSource), a dotted-path traversal) and pushes it into the control'sValueproperty via reflection (PropertyInfo.SetValue).- If
AutoValidateOnDataBindisTrue(default), Validate a bound control and reflect state is invoked. - Concrete subclasses (e.g.,
AutoBindTextbox.LayoutControls) subsequently pushValueinto the underlying HTML/Infragistics editor control (m_Textbox.Text = CStr(Value), etc.) at render time. - On user postback (
Textbox_TextChanged/equivalentValueChangehandlers), the control'sValueis updated from the editor, thenBindToObject()is called:BindingUtility.BindValue(Me, "Value", BoundObject, BindProperty)writes the new value back onto the bound business object. - If
AutoValidateisTrue, Validate a bound control and reflect state runs again.
No SQL/table interaction occurs directly in this operation; it operates purely against in-memory business objects already loaded by the BOF layer.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Control lifecycle calls DataBind]) --> Check{RootBindingObject is Nothing?}
Check -->|Yes| EndNoOp([No-op, return])
Check -->|No| Bind[BindToControl reads BoundObject property into Value]
Bind --> AutoVal{AutoValidateOnDataBind?}
AutoVal -->|Yes| Val[Validate control]
AutoVal -->|No| Render[Render editor with Value]
Val --> Render
Render --> Postback([User edits and posts back])
Postback --> WriteBack[BindToObject writes Value back onto BoundObject]
WriteBack --> AutoVal2{AutoValidate?}
AutoVal2 -->|Yes| Val2[Validate control]
AutoVal2 -->|No| EndOk([Done])
Failure and edge-case behavior¶
RootBindingObject Is Nothing:DataBind()returns immediately without binding the control.BindingUtility.GetObjectValue/SetObjectValue/BindValueswallowNotSupportedExceptioninternally (e.g., for reflection failures on unsupported property types) — the bind silently fails rather than throwing.
Related documentation¶
Sources¶
SAIF.Presentation.Web.Controls.AJAX.Infragistics103\AutoBindControlAncestor.vbSAIF.Presentation.Web.Controls.AJAX.Infragistics103\BindingUtility.vbSAIF.Presentation.Web.Controls.AJAX.Infragistics103\AutoBindTextbox.vbSAIF.Presentation.Web.Controls.AJAX.Infragistics103\AutoBindWebDateTimeEdit.vbSAIF.Presentation.Web.Controls.AJAX.Infragistics103\AutoBindWebMaskEdit.vb