title: How to access controls inside a nested master page? why does it behave differently from content pages?
body: <p>Is there a difference between these two scenarios:</p>
  
  <p>(1) Accessing a property on a master page from a regular child</p>
  
  <p>(2) Accessing a property on a master page from a nested master page</p>
  
  <p>I tried to access a textbox in the master page from a content page like this:</p>
  
  <pre><code>TextBox a;
  a = (TextBox)Master.FindControl("ayyash"); // Master is declared in MasterType directive
  defaultTextbox.Text = a.Text; // defaultTextBox is a textbox control inside default.aspx
  </code></pre>
  
  <p>it works, but then when I applied the same method on a nested master page:</p>
  
  <pre><code>TextBox a;
  a = (TextBox)Master.FindControl("ayyash"); // Master is declared in MasterType directive
  myTextBox.Text = a.Text; // myTextBox is a textbox control inside child.master
  </code></pre>
  
  <p>this does not work, am I missing something? I call both codes inside regulare page_load handler...</p>
  
  <p>I also noticed I cannot set textbox value inside the nested master page from code behind, there is definitely something im missing, what is it?
  To shed light on this issue, here is an example:</p>
  
  <p>Nested Master Page:</p>
  
  <pre><code>&lt;%@ Master Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="false" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt;
  
  &lt;asp:textbox id="tx2" runat="server" text="this is two"&gt;&lt;/asp:textbox&gt;
  &lt;asp:contentplaceholder id="newstuff" runat="server"&gt;&lt;/asp:contentplaceholder&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>Response.Wrote(tx2.Text);
  </code></pre>
  
  <p>I get NOTHING, why what did I miss? note that I also tried the recursive find control:</p>
  
  <pre><code>String str = ((TextBox)((Content)FindControl("Content2")).FindControl("tx2")).Text;
  </code></pre>
  
  <p>still nothing</p>