Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 419055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:44:23+00:00 2026-05-12T18:44:23+00:00

On one site, I’m only using a single level Masterpage and in a page

  • 0

On one site, I’m only using a single level Masterpage and in a page using that master, I can do this.Master.FindControl(“controlName”) to access the control. Works fine.

However, using the same code on a site with two masterpage levels. MainMaster and SpecificMaster which has MainMaster as its Master.

So on the page which uses SpecificMaster, FindControl is returning null for the object. The only difference I’m seeing is the nesting of the masterpages.

When I set breakpoint and look at page.Master, it’s showing SpecificMaster and SpecificMaster is showing MainMaster as its master correctly, but FindControl is still failing.

When I view source in IE, the control is correctly named, no .NET munging going on.

Any thoughts here?

TIA!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:44:23+00:00Added an answer on May 12, 2026 at 6:44 pm

    When you’re nesting master pages, you’ll get an extra container “Content” you need to look through.

    As a result, if you’re trying to use FindControl from a given child page the usual approach is something to the effect of:

    Label myLabel = (Label)this.Master.FindControl("myLabel");
    myLabel.Text = "Success!";
    

    Since we have a nested master page, with “myLabel” in the child master, this control will be contained within a content control.

    So, this changes the code to:

    ContentPlaceHolder ph = (ContentPlaceHolder)this.Master.Master.FindControl("yourContentPane");
    
    Label myLabel = (Label)ph.FindControl("myLabel");
    myLabel.Text = "Success!";
    

    and in VB.NET

    Dim ph As ContentPlaceHolder = DirectCast(Me.Master.Master.FindControl("yourContentPane"), ContentPlaceHolder)
    
    Dim myLabel As Label = DirectCast(ph.FindControl("myLabel"), Label)
    myLabel.Text = "Success!"
    

    The content from the child page is loaded into the first master page control, which is subsequently loaded into the grandparent master page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can you have it where one site master page itself has a site master
I read on one site that you can make constant variables in JavaScript like:
I am migrating websites to a new server and one site that is using
hi i am using joomla for my one site can u help me set
I have one site that is displaying html content that needs to be displayed
I have seen at least one site in the past that had analytics on
I need to build simple site one big page like 37signals product's pages, and
I've read on one site that I need to add two lines to httpd.conf
I have found this question in the one site which was about counting sort
How can I move a document library from one site to another on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.