title: Using FindControl() to find control
body: <p>I have a <code>Literal</code> control that I am trying to locate so I can insert text into it. I have a Master page that contains several content placeholders. </p>
  
  <pre><code>&lt;asp:Content ID="Content7" ContentPlaceHolderID="MainLinks" runat="server"&gt;
      &lt;h3&gt;Project Navigation&lt;/h3&gt;
  &lt;ul class="rightColBoxNav"&gt;
  &lt;asp:Literal ID="litNavLinks" runat="server" /&gt;
  &lt;/ul&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>I keep getting "Object reference not set to an instance of an object." How do I locate this object so I can find and update it?</p>
  
  <p>I have tried:</p>
  
  <pre><code>((Literal)Page.FindControl("litNavLinks")).Text = sb.ToString();
  ((Literal)Page.Page.FindControl("litNavLinks")).Text = sb.ToString();
  ((Literal)Page.FindControl("Content7").FindControl("litNavLinks")).Text = sb.ToString();
  </code></pre>
  
  <p>to no avail. How do I determine the location?</p>