lundi 21 mars 2016

How to hide HTML in DNN Skin with C# if Pane is Empty

I've created a DNN skin, and have approximately 35 module positions. I have HTML like the following in my DNN skin file (.ascx file) along with the pane:

<div class="gridcolumns onecol row1">
    <div class="gridcolumns_outer">
        <div class="gridcolumns_inner">
            <div id="ContentPane01" class="gridcol-12" runat="server" visible="false"><!-- --></div>
        </div>
    </div>
</div>

I've already set runat="server" and visible="false" if no module is at the particular position, and this works correctly - the pane HTML for id="ContentPane01" doesn't show up. But I would also like to add some kind of C#-specific if condition to hide the HTML as well.

My semi-pseudo code example is as follows:

<% if (ContentPane01 !== empty) { %>
<div class="gridcolumns onecol row1">
    <div class="gridcolumns_outer">
        <div class="gridcolumns_inner">
            <div id="ContentPane01" class="gridcol-12" runat="server" visible="false"><!-- --></div>
        </div>
    </div>
</div>
<% } %>

Does anyone know how I go about properly adding the C# code for this to work?

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire