ASP.Net get an error when trying to adjust css in code behind
<p>I have this code in my code behind:</p>

<pre><code>if (Request.QueryString["category"] == "9")
{
    HtmlControl downloadableProducts = (HtmlControl)Page.FindControl("downloadableProducts");
    downloadableProducts.Style.Add("display", "none");
}
</code></pre>

<p>It is generating the following error:</p>

<p>System.NullReferenceException: Object reference not set to an instance of an object. on line 43 which is the this <code>downloadableProducts.Style.Add("display", "none");</code></p>

<p>My div looks like this:</p>

<pre><code>&lt;div id="downloadableProducts" runat="server"&gt;
    &lt;a href="#"&gt;Downloadedable Products&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>What am I doing wrong?</p>

<p>If I remove this line from my code behind:</p>

<pre><code>HtmlControl downloadableProducts = (HtmlControl)Page.FindControl("downloadableProducts");
</code></pre>

<p>I get this error:</p>

<p>The name 'downloadableProducts' does not exist in the current context</p>
