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

# ViewPageBase

`ViewPageBase` is the base ASP.NET `Page` code-behind — the real core of this library's "MVC-style" retrofit onto WebForms. It owns every page lifecycle event (`Page_Init`, `Page_Load`, `Page_PreRender`, `Page_Unload`, `Page_Error`), delegates all non-rendering behavior to a `clsControllerBase` instance, manages ViewState-in-session persistence ([BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users)), and drives centralized error routing via `ProcessError` (see [Error handling](../../operations/error-handling.md)).

## Purpose
- Wires each concrete page to its `clsFactoryBase`/`clsControllerBase` pair and drives the shared initialization/retrieval/error pipeline from ASP.NET's page lifecycle events.
- Implements session-based ViewState persistence for external or explicitly flagged users, reducing ViewState payload size at the cost of server-side session memory ([BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users)).
- Supports multiple concurrent model instances per session via a generated `ViewID` (`__SAIFPID`), enabling the multi-model navigation pattern used by `clsControllerBase.Navigate2`.
- Generates Infragistics-control-aware client-focus JavaScript via its nested `NavigationManager` class, using reflection rather than a compile-time `Infragistics.*` reference.

## 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 page's display mode (e.g., add/edit/view). |
| `VIEWSTATE_CTRL_ENUM` | `Public Enum VIEWSTATE_CTRL_ENUM` | Enumerates ViewState-in-session behavior options (e.g., `ALL_USERS`, `EXTERNAL_USERS`, likely a default/off value) consumed by [BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users). |
| `MessageControl` | `Public Property MessageControl() As Label` | The page's designated label control for displaying status/error messages to the user. |
| `PageMode` | `Public Property PageMode() As PageModeEnum` | The page's current display mode. |
| `ViewStateInSession` | `Public Property ViewStateInSession() As VIEWSTATE_CTRL_ENUM` | Configures which users get server-side (session-based) ViewState persistence rather than the default page-embedded ViewState; see [BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users). |
| `PageStatePersister` | `Protected Overrides ReadOnly Property PageStatePersister() As System.Web.UI.PageStatePersister` | Overrides the base ASP.NET behavior to return a session-based persister when `ViewStateInSession = ALL_USERS`, or `EXTERNAL_USERS` (or the `EXT_VIEWSTATE_SESSION` AppSettings flag) combined with a non-internal (`10.*`) host address; enforces [BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users). |
| `ViewID` | `Public Property ViewID() As String` | The GUID identifying this page's model/view-data instance in session, seeded from the `__SAIFPID` query string/hidden field/session value when multi-model support is in play. |
| `HandleApplicationError` | `Protected Friend Overridable Function HandleApplicationError(ByVal ex As Exception) As Boolean` | Overridable hook giving the concrete page a chance to fully handle an unhandled exception itself; if it returns `True`, `ProcessError` takes no further action — see [Error handling](../../operations/error-handling.md). |

## Nested types
| Type | Kind | Purpose |
| --- | --- | --- |
| `NavigationManager` | `Protected Class NavigationManager` | Generates client-side focus-management JavaScript for a bound control, with Infragistics-control-aware branching (`WebCombo`, `WebDataInput`, `WebSchedule.WebDateChooser`, including a v4.3-specific branch) and `SAIF.UIControls.SAIFWebMaskEdit`/`SAIFWebDateTimeEdit` detection, all via reflection on `GetType.FullName` rather than compile-time `Infragistics.*` references. |

### NavigationManager members
| Member | Signature | Purpose |
| --- | --- | --- |
| `SelectText` | `Public Property SelectText() As Boolean` | Whether the generated focus script should also select the bound control's text content. |
| `BoundControlId` | `Public WriteOnly Property BoundControlId() As System.Web.UI.Control` | Sets the control whose client-side focus script will be generated. |
| `BoundControlName` | `Public ReadOnly Property BoundControlName() As String` | The resolved client-side name/ID used in the generated focus script for the bound control. |
| `GenerateScripts` | `Public Sub GenerateScripts()` | Emits the client-focus JavaScript for the bound control during `Page_PreRender`. |

## Inherited public members

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

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| `IsPostBack` | `Public ReadOnly Property IsPostBack() As Boolean` | Read by `ViewPageBase.Page_Init`/`Page_Load` to decide whether to run the controller's initial-retrieval logic (fresh request) or its postback/input-processing logic, driving the shared MVC-style pipeline's branching. | `System.Web.UI.Page` |
| `Session` | `Public ReadOnly Property Session() As HttpSessionState` | Backs both the multi-model `ViewID` lookup and the session-based ViewState store that `PageStatePersister` writes to for external or flagged users ([BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users)). | `System.Web.UI.Page` |
| `Request` | `Public ReadOnly Property Request() As HttpRequest` | Supplies the `__SAIFPID` query string/hidden-field value `ViewID` reads to select the correct model instance, and the host address `PageStatePersister` inspects to decide whether session-based ViewState applies. | `System.Web.UI.Page` |
| `Response` | `Public ReadOnly Property Response() As HttpResponse` | Used by controller-driven navigation (for example `clsControllerBase.Navigate2`) to redirect between pages while carrying the `ViewID` needed to resume the correct model instance. | `System.Web.UI.Page` |
| `Server` | `Public ReadOnly Property Server() As HttpServerUtility` | Provides server-side utility operations (such as error transfer) available to `ProcessError` and other controller-driven error-handling code. | `System.Web.UI.Page` |
| `Cache` | `Public ReadOnly Property Cache() As Cache` | Standard ASP.NET application-wide `Cache` accessor exposed on the page; no library-specific caching usage by `ViewPageBase` or `clsControllerBase` is established in source.** | `System.Web.UI.Page` |
| `ClientScript` | `Public ReadOnly Property ClientScript() As ClientScriptManager` | Used by `Navigate` to register the client-side script that opens popup windows as part of the page's navigation behavior. | `System.Web.UI.Page` |
| `User` | `Public ReadOnly Property User() As IPrincipal` | Standard ASP.NET authenticated-principal accessor exposed on the page; the internal/external classification `PageStatePersister` actually applies for [BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users) is derived from `Request.UserHostAddress`, not from `User`, so no library-specific use of this property is established in source.** | `System.Web.UI.Page` |
| `Controls` | `Public ReadOnly Property Controls() As ControlCollection` | Exposes the page's top-level control tree so `NavigationManager` and `FindControl` can locate the specific bound Infragistics/SAIF input control targeted by `BoundControlId`. | `System.Web.UI.Control` |
| `Visible` | `Public Property Visible() As Boolean` | Lets `PageMode`-driven controller logic hide or show the page's rendered content as a unit (for example while an error is being handled). | `System.Web.UI.Control` |
| `ViewState` | `Protected ReadOnly Property ViewState() As StateBag` | Holds the page's postback state; `ViewPageBase.PageStatePersister` governs whether this is physically stored in the page (default) or in session, per [BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users). | `System.Web.UI.Control` |
| `DataBind` | `Public Overridable Sub DataBind()` | Standard ASP.NET data-binding entry point on the page; no call site in `ViewPageBase` or `NavigationManager` is established in source, so any invocation by a derived page'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` to resolve the specific input control identified by `BoundControlId` before generating its client-focus script. | `System.Web.UI.Control` |
| `OnInit` | `Protected Overridable Sub OnInit(ByVal e As EventArgs)` | Raises the `Init` event; `ViewPageBase.Page_Init` builds on this lifecycle stage to construct the page's `clsFactoryBase`/`clsControllerBase` pair. | `System.Web.UI.Control` |
| `OnLoad` | `Protected Overridable Sub OnLoad(ByVal e As EventArgs)` | Raises the `Load` event; `ViewPageBase.Page_Load` builds on this lifecycle stage to trigger the controller's initial-retrieval or postback-processing logic based on `IsPostBack`. | `System.Web.UI.Control` |

## Behavioral notes
- `ViewPageBase.aspx` (the markup partner file) declares `Inherits="SAIF.ViewPageBase"` — 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 pages lives in each downstream application project.*
- `PageStatePersister`'s decision to use session-based ViewState combines a page-level `ViewStateInSession` enum setting with the `EXT_VIEWSTATE_SESSION` AppSettings flag and a runtime host-address check — three independent inputs converging on one persistence decision ([BR-MVC-007](../../business-rules.md#br-mvc-007-session-based-viewstate-for-externalflagged-users)).
- `ProcessError` (invoked from `Page_Error`, not itself a listed public member above since it is triggered by the ASP.NET event pipeline rather than called directly) dispatches to `HandleApplicationError`, then SAIF-exception-type-specific handling, then `clsControllerBase.HandleErrors` — see [Error handling](../../operations/error-handling.md) for the full sequence.

## Constraints and usage notes
- `HandleApplicationError` returning `True` fully suppresses the remaining SAIF-exception dispatch and `clsControllerBase.HandleErrors` call — concrete pages must ensure they have genuinely handled the error (e.g., displayed a message) before returning `True`.

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