0
votes

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.

1

1 Answers

0
votes

I figured it out. I can use <% if(id.Visible == true){} %>, where id is the id provided to the pane, along with runat="server"

Here is the code from my original post, with the solution added:

<% if (ContentPane01.Visible == true) { %>
<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>
<% } %>