show or hide controls based on databound values
<p>I have a section in an edit form (using <code>&lt;asp:FormView&gt;</code>) which I would like to display in a different way depending on the value of a databound field.</p>

<p>It currently looks something like this:</p>

<pre><code>&lt;asp:Panel runat="server" Visible='&lt;%# Eval("ClosedBy") != null %&gt;'&gt;
   Closed by user &lt;%# Eval("ClosedBy") %&gt; on &lt;%# Eval("ClosedDate") %&gt;
   &lt;asp:Button runat="server" Text="Reopen" OnClick="Reopen" /&gt;
&lt;/asp:Panel&gt;
&lt;asp:Panel runat="server" Visible='&lt;%# Eval("ClosedBy") == null %&gt;'&gt;
   &lt;asp:Button runat="server" Text="Close" OnClick="Close" /&gt;
&lt;/asp:Panel&gt;
</code></pre>

<p>(I have simplified this example slightly, there is a bit more content in both the Panels.)</p>

<p>Is there a better way of dealing with this?
Is there a way to avoid writing the display condition twice, once for the 'if' Panel and once for the 'else' Panel?</p>
