Using something like this to show/hide certain markup:
<asp:Panel runat="server" ID="MyPanel">
<li>...</li>
<li>...</li>
...
</asp:Panel>
It is rendered out as something like:
<div>
<li>...</li>
<li>...</li>
...
</div>
Now I want to have the ability to show/hide the MyPanel server-side but do not want the surrounding div to be rendered.
I could do something like:
<% if (MyCondition) { %>
<li>...</li>
<li>...</li>
...
<% } %>
but this looks rather cluttered to me.
Or I could do something like:
<li runat="server" ID="C1">...</li>
<li runat="server" ID="C2">...</li>
...
but this would require all "root" controls to have a runat=server attribute which produces a lot of code and looks cluttered, too, to me.
My question:
Is there a way to tell the Panel control to not produce any markup itself? Or is there another control to use for my purpose?