title: Access Masterpage control on a basepage using FindControl
body: <p>I have an ASP.NET website application on .NET 4.0. There is one Masterpage that contains the header and footer for all the aspx pages. The content comes from the individual aspx pages. I have BasePage.cs which all the aspx pages inherit from.</p>
  
  <p>Now to the problem:
  I have a HTML Select control on the masterpage, whose value I am trying to retrieve in the BasePage.cs using the below code</p>
  
  <pre><code>string language = ((System.Web.UI.HtmlControls.HtmlSelect)Master.FindControl("cmbLanguage")).Value;
  </code></pre>
  
  <p>I am using this inside the InitializeCulture method, which would set the Culture info for the website.</p>
  
  <pre><code>protected override void InitializeCulture()
  {
  
      string language = ((System.Web.UI.HtmlControls.HtmlSelect)Master.FindControl("cmbLanguage")).Value;
  
      Thread.CurrentThread.CurrentCulture =
          CultureInfo.CreateSpecificCulture(language);
      Thread.CurrentThread.CurrentUICulture = new
          CultureInfo(language);
      base.InitializeCulture();
  }
  </code></pre>
  
  <p>While debugging, I can see that the expected value is set in the <code>language</code> variable. The problem is when the page renders, the content inside the ContentPlaceHolder for the aspx page is not being rendered. </p>
  
  <p>I can see that it is the code involving <code>FindControl</code> which is the cause, because if I set the language to a string, everything works as expected.</p>
  
  <pre><code>string language = "de-DE";
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>UPDATE:</strong>
  If there is some content on the ContentPlaceHolder on the MasterPage, then it gets rendered instead of the page ContentPlaceHolder.</p>