如果子菜单为空,如何删除菜单类

时间:2016-12-13 05:05:42

标签: c# jquery

我使用转发器控件绑定到 <UL>

<ul id="menu-content" class="menu-content collapse out">
  <asp:Repeater ID="rptMenu" runat="server" OnItemDataBound="rptMenu_OnItemBound">
    <ItemTemplate>
      <li data-toggle="collapse" data-target="#li<%# ((RepeaterItem)Container).ItemIndex + 1%>" class="collapsed active"><a id="A1">
        <asp:HiddenField ID="HiddenField1" runat="server" Value='<%#Eval("Id") %>' />
        <%#Eval("Name")%>
        <span class="arrow"></span></a>
      </li>
      <ul class="sub-menu collapse" id="li<%# ((RepeaterItem)Container).ItemIndex + 1%>">
        <asp:Repeater ID="rptChildMenu" runat="server">
          <ItemTemplate>
            <li>
              <a id="A2" href='<%#Eval("Name") %>' runat="server"><%#Eval("Name")%></a>
            </li>
          </ItemTemplate>
        </asp:Repeater>
      </ul>
    </ItemTemplate>
  </asp:Repeater>
</ul>

如果没有子菜单项,箭头图标应隐藏或不应呈现:

<span class="arrow"></span>

0 个答案:

没有答案