title: How to set Page's Title from a web content page in ASP.NET 3.5
body: <p>I've read through quite a bit of posts/articles on how to do this and I still am not getting the page title set from the content page. My pages render OK except I can't get the title set from the content page (all the page's have Title set as per the master page). Here's the codebehind for my master page:</p>
  
  <pre><code>Partial Class zSEO
  Inherits System.Web.UI.MasterPage
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
          Page.Header.Title = "Dynamically set in Master page"
      End Sub
  End Class
  </code></pre>
  
  <p>Here is the rest of the master page:</p>
  
  <pre><code>&lt;%@ Master Language="VB" 
  EnableTheming="true"
  Inherits="zSEO" 
  CodeFile="zSEO.master.vb" %&gt;
  &lt;!DOCTYPE html 
   PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
   &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
       &lt;head id="Head1" runat="server"&gt;
           &lt;title&gt;&lt;/title&gt;
       &lt;/head&gt;
   &lt;body&gt;
   &lt;form id="form1" runat="server"&gt;    
  
   &lt;div id="container"&gt;
       &lt;div id="content"&gt;
           &lt;asp:contentplaceholder id="ContentPlaceHolder1" runat="server"&gt;
           &lt;/asp:contentplaceholder&gt;
       &lt;/div&gt;    
   &lt;/div&gt;      
   &lt;/form&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Yet, it is in the web content page that I want to establish the value of the  for the page and I have placed this in my testing content page:</p>
  
  <pre><code>Public Partial Class zShowAd
  Inherits System.Web.UI.Page
  
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
      Page.Header.Title = "Dynamically set TITLE value in the content(child) page"
  End Sub
  
  End Class
  </code></pre>
  
  <p><strong>Strangely, I cannot get the debugger to stop on the line above in the content page - only on the corresponding line in the master page. Clearly, I am confused on this.</strong></p>
  
  <p>I've read there are other ways to do this but this seemed to be possible from what I read at Scott Mitchell's tutorial at: <a href="https://web.archive.org/web/20210417084947/https://www.4guysfromrolla.com/demos/printPage.aspx?path=/articles/051006-1.aspx" rel="noreferrer">Dynamically setting the Page Title in ASP.NET</a>. Specifically, I tried to follow this from the article:
  <em>"Furthermore, if you are using master pages, this code can work, as written, from either the master page or the ASP.NET page that uses the master page. In such a scenario, the  region should be defined in the master page, but the ASP.NET page can still access it via Page.Header. "</em></p>