Skip to content

clsControlManager

clsControlManager is a stateless, Shared-only helper class used throughout consuming applications' page code to recursively enable/disable/protect form controls, clear/reset control display state, bind dropdown/grid value lists, and generate Infragistics grid edit-mode and scroll JavaScript — all via reflection over each control's runtime properties rather than compile-time type-specific code paths.

Purpose

  • Recursively enable or disable an entire control tree (a single control or a whole page form), skipping recursion into WebCombo internals per BR-CM-001.
  • Clear/reset the selected value and CSS state of a wide range of supported input control types (TextBox, CheckBox, DropDownList, Infragistics WebDropDown, etc.) via reflection.
  • Bind value-list data to dropdown and grid controls across several supported control families (DropDownList, SAIFDropDownList, Infragistics WebDropDown, UltraWebGrid, WebDataGrid).
  • Generate client-side JavaScript for Infragistics grid scroll-to-view and begin-edit behaviors.

Context

  • Namespace: SAIF.Presentation.Web.Core.Utilities
  • Assembly/package: SAIF.Presentation.Web.Core.Infragistics103 (merged into SAIF.BOF.Presentation.Web.Infragistics103 NuGet package)

Public members

Member Signature Purpose
DDLAddItems Public Enum DDLAddItems { BlankLiteral, EmptyString, Space } Enumerates the style of blank placeholder item to prepend when binding a dropdown list.
ClearItems Shared Sub ClearItems(inCntrl As Control) Recursively clears the selected value/text and resets CSS class on all supported descendant input controls of inCntrl, via reflection over each control's properties.
ItemError Shared Sub ItemError(inCntrl As Control) Sets a control's CssClass property (via reflection) to "errorbackcolor" to flag it as invalid.
EnablePageControl Shared Sub EnablePageControl(inCntrl As Control, inEnable As Boolean) (overload 1) Recursively enables or disables a control and its children; skips recursing into WebCombo children per BR-CM-001.
EnablePageControl Shared Sub EnablePageControl(inPage As Page, inEnable As Boolean) (overload 2) Enables or disables every control in the page's form, skipping the SAIFMenu control entirely and excluding the mnuHelp button within SAIFMenuTop.
EnablePageControl Shared Sub EnablePageControl(inMenuButton As SAIFMenuTop.clsMenuButton, inEnable As Boolean) (overload 3) Directly sets the Enabled property of a single navigation menu button.
GetProperty Shared Function GetProperty(inItem As Object, inPropName As String) As Object Returns the value of a named property on an object via a case-insensitive reflection lookup (Type.GetProperty(inPropName).GetValue(inItem, Nothing)), or Nothing if not found.
ProtectItem Shared Sub ProtectItem(inCntrl As Control) Applies read-only/disabled visual and behavioral state to a control (reflection-based; exact property set depends on control type)*.
UnProtectItem Shared Sub UnProtectItem(inCntrl As Control) Removes read-only/disabled visual and behavioral state from a control (reflection-based; exact property set depends on control type)*.
SetEnableable Shared Sub SetEnableable(inControl As System.Web.UI.WebControls.WebControl, inEnableable As Boolean) Marks whether a control participates in enable/disable operations.
ResetBackColor Shared Sub ResetBackColor(inControl As Control) Recursively resets the CSS background-color class of supported input controls across a control tree; called from AppViewPageBase.Page_Load when CallResetBackcolor is True.
EnableGridCell Shared Sub EnableGridCell(inCell As Infragistics.WebUI.UltraWebGrid.UltraGridCell, isEnable As Boolean) Enables or disables an individual UltraWebGrid cell's edit state by setting inCell.AllowEditing to Yes/No.
GridScrollToView Shared Sub GridScrollToView(inPage As Page, inGridID As String, inRow As Infragistics.WebUI.UltraWebGrid.UltraGridRow) (overload 1); Shared Sub GridScrollToView(inPage As Page, inGridID As String, inRecord As GridRecord) (overload 2) Generates/registers client-side script to scroll an UltraWebGrid (overload 1) or WebDataGrid (overload 2) so a given row/record is visible.
GridBeginEdit Shared Sub GridBeginEdit(inPage As Page, inGridID As String, inRow As Infragistics.WebUI.UltraWebGrid.UltraGridRow, inColumnKey As String, [inSelectRow As Boolean = True], [inWarp As Control = Nothing]) (overload 1); Shared Sub GridBeginEdit(inPage As Page, inRow As Infragistics.WebUI.UltraWebGrid.UltraGridRow, inColumnKey As String, [inSelectRow As Boolean = True], [inWarp As Control = Nothing]) (overload 2) Generates/registers client-side script to place an UltraWebGrid cell into edit mode; overload 1 retains an unused inGridID parameter for backward compatibility and delegates to overload 2.
WdgBeginEdit Shared Sub WdgBeginEdit(inPage As Page, inGrid As Infragistics.Web.UI.GridControls.WebDataGrid, inRowIndex As Integer, inColumnKey As String, [inSelectRow As Boolean = True]) WebDataGrid-specific variant of the begin-edit script generation.
WhdgBeginEdit Shared Sub WhdgBeginEdit(inPage As Page, inGrid As Infragistics.Web.UI.GridControls.WebHierarchicalDataGrid, inRootIndex As Integer, inBand As String, inRowIndex As Integer, inColumnKey As String, [inSelectRow As Boolean = True]) Hierarchical-grid-specific variant of the begin-edit script generation.
AddDropDownProvider Shared Sub AddDropDownProvider(inGrid As WebDataGrid, inColumnID As String, [inHeight As Integer = 0], [inWidth As Integer = 0]) Registers a DropDownProvider data-provider source for a WebDataGrid column prior to binding.
LoadDDL Shared Sub LoadDDL(inDataGrid As Infragistics.Web.UI.GridControls.WebDataGrid, inCodeTable As Object, inBindColumn As String, inValueMember As String, inDisplayMember As String, inPrompt As String, [inAddItems As Hashtable = Nothing]); Shared Sub LoadDDL(inDataGrid As Infragistics.Web.UI.GridControls.WebDataGrid, inCodeTable As Object, inBindColumn As String, inValueMember As String, inDisplayMember As String, inPrompt As String, inAddItem As DDLAddItems); Shared Sub LoadDDL(inDataGrid As Infragistics.WebUI.UltraWebGrid.UltraWebGrid, inCodeTable As Object, inBindColumn As String, inValueMember As String, inDisplayMember As String, inPrompt As String, [inAddItems As Hashtable = Nothing]); Shared Sub LoadDDL(inDataGrid As Infragistics.WebUI.UltraWebGrid.UltraWebGrid, inCodeTable As Object, inBindColumn As String, inValueMember As String, inDisplayMember As String, inPrompt As String, inAddItem As DDLAddItems); Shared Sub LoadDDL(inDDL As System.Web.UI.WebControls.DropDownList, inDataSource As Object, inValue As String, inText As String, [inAddItems As Hashtable = Nothing]); Shared Sub LoadDDL(inDDL As System.Web.UI.WebControls.DropDownList, inDataSource As Object, inValue As String, inText As String, inAddItem As DDLAddItems); Shared Sub LoadDDL(inDDL As Controls.V2.SAIFDropDownList, inDataSource As Object, inValue As String, inText As String, [inAddItems As Hashtable = Nothing]); Shared Sub LoadDDL(inDDL As Controls.V2.SAIFDropDownList, inDataSource As Object, inValue As String, inText As String, inAddItem As DDLAddItems); Shared Sub LoadDDL(inDDL As Infragistics.Web.UI.ListControls.WebDropDown, inDataSource As Object, inValue As String, inText As String, [inAddItems As Hashtable = Nothing]); Shared Sub LoadDDL(inDDL As Infragistics.Web.UI.ListControls.WebDropDown, inDataSource As Object, inValue As String, inText As String, inAddItem As DDLAddItems) (10 overloads across 5 control types) Binds a value list to a dropdown or grid control, across DropDownList, SAIFDropDownList, Infragistics WebDropDown, UltraWebGrid, and WebDataGrid control types, optionally prepending a blank item per DDLAddItems or an arbitrary Hashtable of extra items.

Behavioral notes

  • Nearly every member operates via System.Reflection (Type.GetProperty(inPropName).GetValue(inItem, Nothing) for reads, .SetValue(inItem, value, Nothing) for writes) against the control's runtime type name rather than a compile-time interface, so support for a given control type is determined by an internal Select Case on GetType.Name.
  • EnablePageControl(inCntrl, inEnable) explicitly skips recursing into WebCombo children, enforcing BR-CM-001; all other control types recurse normally.
  • EnablePageControl(inPage, inEnable) always excludes the SAIFMenu control from enable/disable, and within SAIFMenuTop specifically excludes the mnuHelp button.

Constraints and usage notes

  • All members are Shared; this class holds no instance state.
  • Because control support is reflection/name-based, adding a new control type to any of these operations requires updating the relevant internal Select Case list rather than implementing an interface.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Presentation.Web.Core.Infragistics103\clsControlManager.vb