Skip to content

ViewControlBase

ViewControlBase is the UserControl counterpart of ViewPageBase, used when a SAIF screen is composed as an embeddable ASCX control rather than a full page. It runs its own controller (from a clsFactoryBase implementation supplied by the derived control) through the ASP.NET control lifecycle — Page_Init constructs and initializes the controller, Page_Error delegates to clsControllerBase.HandleErrors(), and Page_Unload calls UnInitialize — mirroring ViewPageBase's pipeline but without view-identity/multi-model support or an overridden PageStatePersister, since those are page-level, not control-level, concerns.

Purpose

  • Gives an ASP.NET user control the same controller-driven initialize/retrieve/uninitialize lifecycle that ViewPageBase gives a full page.
  • Exposes ApplicationName as a pass-through to the underlying model's context, so markup and code-behind in the control can read/set the owning application without reaching through the controller.
  • Provides a PageMode property (via its own nested PageModeEnum) so a control can track its own view/update/delete/print/PDF state independently of any hosting page.

Context

  • Namespace: SAIF.Presentation.Web.MVC*
  • Assembly/package: SAIF.Presentation.Web.MVC

Public members

Member Signature Purpose
PageMode Public Property PageMode() As PageModeEnum The current view/update/delete/print/PDF mode for this control instance, held in the control's own ViewState
ApplicationName Public Property ApplicationName() As String Pass-through accessor to m_controller.Model.Context.ApplicationName — reads/sets the application name on the underlying model context
PageModeEnum Public nested enum See ViewControlBase.PageModeEnum

Behavioral notes

  • Unlike ViewPageBase, ViewControlBase's NavigationManager is constructed but never wired up in the observed code — the NavManager = New NavigationManager(Me) call in Page_Load and NavManager.GenerateScripts() in Page_PreRender are both commented out, so focus restoration is effectively inactive for user controls despite the supporting class being present.
  • Page_Error calls the parameterless clsControllerBase.HandleErrors() overload (which reads the error from HttpContext.Current.Error), not the exception-parameter overload that ViewPageBase.ProcessError uses — so a control does not get the richer SAIF-exception classification (timeout/unavailable messaging) that ViewPageBase.ProcessError performs.

Constraints and usage notes

  • ApplicationName's getter/setter both assume m_controller and m_controller.Model are already initialized (set during Page_Init); accessing it before Page_Init has run would fail.*

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.MVC/ViewControlBase.ascx.vb