title: Accessing user control on child master page from child master page code behind
body: <p>Trying to set the value of a literal user control on my child master page via the code behind of the same master page.</p>
  
  <p>Here is example of the code I am using:</p>
  
  <p><strong>Global.master</strong></p>
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
      &lt;asp:ContentPlaceHolder id="GlobalContentPlaceHolderBody" runat="server"&gt;
  
      &lt;/asp:ContentPlaceHolder&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Template.master (child of Global.master)</strong></p>
  
  <pre><code>&lt;asp:Content ID="TemplateContentBody" ContentPlaceHolderID="GlobalContentPlaceHolderBody" Runat="Server"&gt;
  &lt;asp:Literal ID="MyLiteral1" runat="Server"&gt;&lt;/asp:Literal&gt;
  
  &lt;p&gt;This is template sample content!&lt;/p&gt;
    &lt;asp:ContentPlaceHolder ID="TemplateContentPlaceHolderBody" runat="server"&gt;
  
  &lt;/asp:ContentPlaceHolder&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Template.master.cs</strong></p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
  {
      MyLiteral1.Text = "Test";
  }
  </code></pre>
  
  <p><strong>ContentPage.aspx</strong></p>
  
  <pre><code>&lt; asp:Content ID="ContentBody" ContentPlaceHolderID="TemplateContentPlaceHolderBody" Runat="Server"&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Once I am able to achieve this, I will also need to be able to access content on the global and template master pages via content pages.</p>