---
title: ViewControlBase
summary: API reference for ViewControlBase.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.MVC
reference_type: package
---

# ViewControlBase

`ViewControlBase` is the base ASP.NET `UserControl` code-behind that consuming applications inherit from to get a control wired to a `clsFactoryBase`/`clsControllerBase` pair, mirroring the page-level pattern implemented by `ViewPageBase`. Its nested `NavigationManager` class generates client-side focus-management JavaScript for the control's bound input.

## Purpose
- Wires a user control into the same factory/controller pattern used by `ViewPageBase`, so partial-page controls can share the shared MVC-style pipeline.
- Provides a `PageMode` enum property mirroring `ViewPageBase.PageModeEnum` for consistent add/edit/view-mode signaling at the control level.
- Generates client-focus JavaScript for a bound control via the nested `NavigationManager` class.

## Context
- Namespace: `SAIF.Presentation.Web.MVC`
- Assembly/package: `SAIF.BOF.Presentation.Web.Infragistics103` (source-bundled)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `PageModeEnum` | `Public Enum PageModeEnum` | Enumerates the control's display mode (e.g., add/edit/view); values mirror `ViewPageBase.PageModeEnum`. |
| `PageMode` | `Public Property PageMode() As PageModeEnum` | The control's current display mode. |
| `ApplicationName` | `Public Property ApplicationName() As String` | The application name this control instance is associated with. |

## Nested types
| Type | Kind | Purpose |
| --- | --- | --- |
| `NavigationManager` | `Protected Class NavigationManager` | Generates client-side JavaScript to set initial input focus on a bound control, with type-specific handling determined via reflection (`GetType.FullName` string checks) rather than compile-time references to vendor control assemblies. |

### NavigationManager members
| Member | Signature | Purpose |
| --- | --- | --- |
| `BoundControlId` | `Public WriteOnly Property BoundControlId() As WebControl` | Sets the control whose client-side focus script will be generated. |
| `GenerateScripts` | `Public Sub GenerateScripts()` | Emits the client-focus JavaScript for the bound control during the control's render/pre-render phase. |

## Inherited public members

Members in this section are inherited from `System.Web.UI.UserControl` (and its base `System.Web.UI.Control`/`System.Web.UI.TemplateControl`). They are available on this type through inheritance and are commonly used by consumers of `ViewControlBase`-derived controls.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `Page` | `Public Property Page() As Page` | Gives the control's factory/controller code access to the hosting `ViewPageBase`-derived page, so a control can reach page-level context (for example the page's `ViewID`/model instance or `MessageControl`) rather than duplicating that plumbing at the control level. | `System.Web.UI.UserControl` |
| `Attributes` | `Public ReadOnly Property Attributes() As AttributeCollection` | Lets control code-behind set ad hoc HTML attributes on the control's outer tag when the strongly typed `ViewControlBase`/`PageMode` surface doesn't cover a needed rendering detail. | `System.Web.UI.UserControl` |
| `IsPostBack` | `Public ReadOnly Property IsPostBack() As Boolean` | Distinguishes the control's first load (when the controller typically performs initial data retrieval) from a postback (when it typically only processes user input), mirroring the same distinction `ViewPageBase` makes at the page level. | `System.Web.UI.UserControl` |
| `Session` | `Public ReadOnly Property Session() As HttpSessionState` | Gives the control access to the same `HttpSessionState` that `ViewPageBase` uses for session-based ViewState persistence and multi-model `ViewID` storage, so a control's controller can share that session-scoped state. | `System.Web.UI.UserControl` |
| `Request` | `Public ReadOnly Property Request() As HttpRequest` | Exposes the inbound request (query string, form values, host address) to the control's controller, the same request data `ViewPageBase` inspects for its `__SAIFPID` view identifier and host-based ViewState decision. | `System.Web.UI.UserControl` |
| `Response` | `Public ReadOnly Property Response() As HttpResponse` | Lets the control's controller write directly to the outgoing response (for example redirects or headers) as part of the shared factory/controller pipeline. | `System.Web.UI.UserControl` |
| `Server` | `Public ReadOnly Property Server() As HttpServerUtility` | Provides server-side utility operations (such as HTML encoding or error transfer) available to the control's controller code. | `System.Web.UI.UserControl` |
| `Cache` | `Public ReadOnly Property Cache() As Cache` | Standard ASP.NET application-wide `Cache` accessor exposed on the control; no library-specific caching usage by `ViewControlBase` or its controllers is established in source.** | `System.Web.UI.UserControl` |
| `Controls` | `Public ReadOnly Property Controls() As ControlCollection` | Exposes the control's child-control tree so `NavigationManager` and controller code can locate the specific bound input (for example the control targeted by `BoundControlId`) at render time. | `System.Web.UI.Control` |
| `ID` | `Public Property ID() As String` | Identifies the control instance within its naming container; controllers and `FindControl` calls in the shared pipeline use this to resolve a specific bound child. | `System.Web.UI.Control` |
| `Visible` | `Public Property Visible() As Boolean` | Lets controller logic driven by `PageMode` (add/edit/view) hide or show the control as a unit, without removing it from the control tree. | `System.Web.UI.Control` |
| `ViewState` | `Protected ReadOnly Property ViewState() As StateBag` | Holds the control's own postback state; because `ViewControlBase` does not override `PageStatePersister` itself, this state is persisted according to whatever policy the hosting `ViewPageBase` page applies. | `System.Web.UI.Control` |
| `DataBind` | `Public Overridable Sub DataBind()` | Standard ASP.NET data-binding entry point on the control; no call site in `ViewControlBase` or `NavigationManager` is established in source, so any invocation by a derived control's own code-behind is outside this library's traced behavior.** | `System.Web.UI.Control` |
| `FindControl` | `Public Function FindControl(ByVal id As String) As Control` | Used by `NavigationManager` and controller code to resolve the specific input control identified by ID before generating focus scripts or binding data to it. | `System.Web.UI.Control` |
| `OnInit` | `Protected Overridable Sub OnInit(ByVal e As EventArgs)` | Extension point derived controls can override to run their own setup before the factory/controller pair begins its initialization sequence. | `System.Web.UI.Control` |
| `OnLoad` | `Protected Overridable Sub OnLoad(ByVal e As EventArgs)` | Extension point derived controls can override to hook the control-level Load stage of the same lifecycle that `ViewPageBase.Page_Load` drives at the page level. | `System.Web.UI.Control` |

## Behavioral notes
- `ViewControlBase.ascx` (the markup partner file) declares `Inherits="SAIF.ViewControlBase"` — a namespace (`SAIF`) inconsistent with the project's actual root namespace (`SAIF.Presentation.Web.MVC`), suggesting this markup file is legacy scaffolding not served directly; real markup for consuming controls lives in each downstream application project.*
- `NavigationManager` has no compile-time reference to any `Infragistics.*` assembly; all vendor-control-type detection is done via reflection on `GetType.FullName`.

## Constraints and usage notes
- Consuming applications are expected to inherit `ViewControlBase` in their own ASCX code-behind and supply markup independently, given the namespace mismatch noted above.

> **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.MVC\ViewControlBase.ascx.vb
- SAIF.Presentation.Web.MVC\ViewControlBase.ascx
