---
title: Nested master page and control resolution
summary: Walks and searches a chain of nested ASP.NET master pages to locate controls in ancestor content placeholders.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Core.Infragistics111
reference_type: package
operation_id: OP-CORE-014
trigger: Consuming page or control needs a control that lives in an ancestor master page
---

# Nested master page and control resolution

This operation walks a chain of nested ASP.NET master pages to count nesting depth, locate a specific ancestor master, or recursively find a control inside a named content placeholder anywhere in the master chain.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-CORE-014 |
| **Trigger** | Consuming page or control needs a control that lives in an ancestor master page |
| **Inputs** | `Page`, control ID, optional content placeholder ID |
| **Outputs** | `MasterPage` or `Control` reference |
| **Primary components** | `clsNestedMaster.MasterLevelCount`, `clsNestedMaster.Root`, `clsNestedMaster.FindMaster`, `clsNestedMaster.FindControl` |
| **Entry point** | `SAIF.Presentation.Web.Core.Infragistics111/clsNestedMaster.vb` |

## Steps

1. `MasterLevelCount` recurses from `page.Master` upward, counting levels until a master with no parent master is reached. ([BR-CORE-035](../business-rules.md#br-core-035-the-root-master-page-is-the-first-ancestor-master-with-no-parent-master))
2. `FindMaster` recurses to the requested ancestor level (default 1); `Root` returns the outermost master.
3. `FindControl` starts from the root master and recursively walks the control tree, returning the first control found inside a `ContentPlaceHolder` whose `ID` matches `contentPlaceHolderID`. ([BR-CORE-036](../business-rules.md#br-core-036-control-search-within-nested-masters-is-scoped-to-the-named-content-placeholder-when-one-is-supplied))
4. If the recursive search yields nothing, fall back to a direct `FindControl` on the root master. ([BR-CORE-037](../business-rules.md#br-core-037-if-the-recursive-nested-search-finds-nothing-a-direct-findcontrol-on-the-root-master-is-attempted))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([FindControl / FindMaster / MasterLevelCount called]) --> S1[Recurse from page.Master upward]
	S1 --> S2[MasterLevelCount: count until master with no parent]
	Start --> S3[FindMaster: recurse to requested ancestor level, default 1]
	S3 --> S4[Root: returns outermost master]
	Start --> S5[FindControl: walk from root master downward]
	S5 --> D1{Control found in matching ContentPlaceHolder?}
	D1 -->|Yes| EndOk([Return matched control])
	D1 -->|No| S6[Fallback: direct FindControl on root master]
	S6 --> EndFallback([Return fallback result, possibly Nothing])
```

## Failure and edge-case behavior
- If both the recursive search and the fallback `FindControl` on the root master fail, `FindControl` returns `Nothing` to the caller, which must itself guard against a null control reference.**

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `SAIF.Presentation.Web.Core.Infragistics111/clsNestedMaster.vb`
