Skip to content

Utilities.clsControlManager

Utilities.clsControlManager is a stateless static service that centralizes control-manipulation logic shared across every SAIF application page: back-color normalization, protect/unprotect transitions, page/control enable-disable, drop-down list population for ASP.NET/SAIF/Infragistics list controls, and Infragistics grid client-side scripting (scroll-to-view, begin-edit, edit-focus, cell enablement). It uses reflection to read/write properties like CssClass and ReadOnly so a single implementation can operate across many unrelated control types.

Purpose

  • Recursively normalize control CssClass back-color tokens on every page load, distinguishing read-only from editable state and exempting the menu context box. (BR-CORE-005, BR-CORE-006, BR-CORE-007, BR-CORE-008)
  • Transition a control between editable and read-only/protected states, including substituting a read-only text box for a DropDownList. (BR-CORE-009, BR-CORE-010)
  • Enable or disable an entire control subtree (Page, Control, or SAIFMenuTop.clsMenuButton). (BR-CORE-034)
  • Populate list controls and grid drop-down editor columns from a data source, with an optional leading blank entry. (BR-CORE-032)
  • Emit client-side script that scrolls to, begins editing, or focuses a specific cell in UltraWebGrid, WebDataGrid, or WebHierarchicalDataGrid. (BR-CORE-033)

Context

  • Namespace: SAIF.Presentation.Web.Core.Utilities
  • Assembly/package: SAIF.Presentation.Web.Core.Infragistics111 (merged into SAIF.Presentation.Web.Infragistics111.dll via SAIF.BOF.Presentation.Web.Infragistics111.nuspec)

Public members

Member Signature Purpose
ResetBackColor(control) Public Shared Sub ResetBackColor(control As Control) Recurses into every child control, strips prior errorbackcolor/errorbordercolor/disabledbackcolor/defaultbackcolor tokens from CssClass, and re-applies the correct token per control type and ReadOnly state; skips the CVTextBox menu context box.
ProtectItem(control) Public Shared Sub ProtectItem(control As Control) Transitions the control to a read-only/protected visual and functional state, using a type-specific rule set (text/edit types get ReadOnly=True plus the disabled CSS class; combo/list types get Enabled=False; plain DropDownList is replaced on-screen by a derived read-only text box).
UnProtectItem(control) Public Shared Sub UnProtectItem(control As Control) Reverses ProtectItem's transformation for the same control-type families, restoring editability.
ItemError(control) Public Shared Sub ItemError(control As Control) Marks the control with the error CSS class so validation failures are visually highlighted.
EnablePageControl(page, enable) Public Shared Sub EnablePageControl(page As Page, enable As Boolean) Walks the entire page's control collection and applies the enable flag to every child control.
EnablePageControl(control, enable) Public Shared Sub EnablePageControl(control As Control, enable As Boolean) Applies the enable flag to the given control, recursing into its children where present.
EnablePageControl(menuButton, enable) Public Shared Sub EnablePageControl(menuButton As SAIFMenuTop.clsMenuButton, enable As Boolean) Applies the enable flag to a top-menu button so a specific menu action can be suppressed.
LoadDDL(...) (ten overloads) Public Shared Sub LoadDDL(list As Object, dataSource As Object, valueField As String, textField As String, Optional addItems As DDLAddItems = DDLAddItems.None) Clears the target list control, binds the supplied data source with the given value/text field mapping, and optionally pre-pends a blank entry per DDLAddItems.
AddDropDownProvider(grid, columnKey, dataSource, valueField, textField) Public Shared Sub AddDropDownProvider(grid As WebDataGrid, columnKey As String, dataSource As Object, valueField As String, textField As String) Registers a DropDownProvider against the named WebDataGrid column so in-grid editing offers the supplied list instead of free text.
DDLAddItems Public Enum DDLAddItems (BlankLiteral, EmptyString, Space) Selects the representation of the optional leading blank entry inserted by LoadDDL.
GridScrollToView(page, gridID, row) Public Shared Sub GridScrollToView(page As Page, gridID As String, row As Object) Registers client script that scrolls the specified UltraWebGrid row into view.
GridBeginEdit(page, gridID, row, columnKey) Public Shared Sub GridBeginEdit(page As Page, gridID As String, row As Object, columnKey As String) Registers client script that begins in-place editing on the specified UltraWebGrid cell.
WdgBeginEdit(page, gridID, record, columnKey) Public Shared Sub WdgBeginEdit(page As Page, gridID As String, record As Object, columnKey As String) Registers the WebDataGrid-flavour equivalent of GridBeginEdit.
WhdgBeginEdit(page, gridID, record, columnKey) Public Shared Sub WhdgBeginEdit(page As Page, gridID As String, record As Object, columnKey As String) Registers the WebHierarchicalDataGrid-flavour equivalent of GridBeginEdit.
GridEditFocus(page, gridID, row, columnKey) Public Shared Sub GridEditFocus(page As Page, gridID As String, row As Object, columnKey As String) Registers client script that focuses (without necessarily beginning edit on) the specified grid cell.
MasterGridEditFocus(page, gridID, row, columnKey) Public Shared Sub MasterGridEditFocus(page As Page, gridID As String, row As Object, columnKey As String) Registers the master-grid variant of GridEditFocus for hierarchical/master-detail grids.
ClearMasterGridEditFocus(page, gridID) Public Shared Sub ClearMasterGridEditFocus(page As Page, gridID As String) Removes a previously registered master-grid focus request when it is no longer needed.
EnableGridCell(cell, enable) Public Shared Sub EnableGridCell(cell As UltraGridCell, enable As Boolean) Toggles an UltraGridCell between editable and read-only, independent of the scroll/focus scripts.

Behavioral notes

  • ResetBackColor, ProtectItem, and UnProtectItem all rely on reflection to read/write properties (CssClass, ReadOnly, Enabled) that are not guaranteed to exist on every control type; controls without the relevant property are simply skipped for that step.
  • The DropDownList protection path (ProtectItem) derives its companion text box ID by upper-casing the control ID and replacing DDL with txt; failures locating that companion control are absorbed by a Try block rather than surfaced to the caller.

Constraints and usage notes

  • None of the ten LoadDDL overloads validate that the supplied value/text field names exist on the data source; a mismatch surfaces as a runtime binding exception.**
  • Grid scroll/begin-edit/focus helpers assume the grid ID and row/record reference are valid at script-registration time; no validation is performed before script assembly.**

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.Infragistics111/clsControlManager.vb