Skip to content

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)
  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)
  4. If the recursive search yields nothing, fall back to a direct FindControl on the root master. (BR-CORE-037)

Process flow

The following diagram visualizes this operation's control flow.

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.**

Sources

  • SAIF.Presentation.Web.Core.Infragistics111/clsNestedMaster.vb