Nullreference exception - why?
<pre><code>Panel pnl_Confirmation = (Panel)form1.FindControl("ConfirmationPanel") as Panel;
    pnl_Confirmation.Visible = false;
</code></pre>

<p>I keep getting a "NullReferenceException" in the above code.  "ConfirmationPanel" is a panel I show/hide depending on if the form is submitted successfully or not.</p>

<p>The panel is wrapped in a LoginView control, which is why I cannot call "ConfirmationPanel" directly:</p>

<pre><code>&lt;asp:LoginView ID="LoginView1" runat="server"&gt;
&lt;LoggedInTemplate&gt; 
&lt;asp:Panel id="ConfirmationPanel" runat="server" Wrap="False"&gt;
</code></pre>

<p>...</p>

<p>Why is this null?  It should be referencing the Panel with the ID "ConfirmationPanel", no?</p>

<p>Thanks</p>
