title: c# asp.net master page get a href and set visible to false
body: <p>I have an a href link in my user.master page, but I'm unable to find that control in my user.master.cs. How do I do so? I tried using master and find control, but it says object reference is not instance to an object or it does not work. Please help, thanks.</p>
  <p>user.master</p>
  <pre><code>&lt;a href=&quot;ViewPremiumPlans.aspx&quot; id=&quot;showUpgradeLink&quot; class=&quot;btn-light btn-sm&quot;&gt;Upgrade&lt;/a&gt;
  </code></pre>
  <p>user.master.cs
  (first try)</p>
  <pre><code>var masterPage = Master;
   if (masterPage != null)
   {
       masterPage.FindControl(&quot;showUpgradeLink&quot;).Visible = true;
   }
  </code></pre>
  <p>(second try)</p>
  <pre><code>this.Master.FindControl(&quot;showUpgradeLink&quot;).Visible = false;
  </code></pre>