Css 使用面板从主菜单中删除空DDL

Css 使用面板从主菜单中删除空DDL,css,asp.net,vb.net,Css,Asp.net,Vb.net,我有一个主菜单,其中每个菜单类别都会下拉。它从数据库中读取下拉数据,有时特定菜单选项在下拉时不包含任何内容。因此,如果下拉列表为空,我希望删除该菜单选项。这是我的密码 <li><a style="color:#fff";"> <asp:DropDownList ID="ddl1" runat="server" style="font-weight: bold; color:#fff;background:#444444; border:0; text-in

我有一个主菜单,其中每个菜单类别都会下拉。它从数据库中读取下拉数据,有时特定菜单选项在下拉时不包含任何内容。因此,如果下拉列表为空,我希望删除该菜单选项。这是我的密码

<li><a style="color:#fff";">
    <asp:DropDownList ID="ddl1" runat="server" style="font-weight: bold; color:#fff;background:#444444; border:0;  text-indent: 5%; text-align-last:center; z-index:-1;" class="fixDDLCategorySize" Height="29px" AutoPostBack="True" OnSelectedIndexChanged="ddl1_SelectedIndexChanged"  >
    </asp:DropDownList></a>
</li>

<li><a style="color:#fff";">
    <asp:DropDownList ID="ddl2" runat="server" style="font-weight: bold; color:#fff;background:#444444; border:0;  text-indent: 5%; text-align-last:center; z-index:-1;" class="fixDDLCategorySize" Height="29px" AutoPostBack="True" OnSelectedIndexChanged="ddl2_SelectedIndexChanged"  >
    </asp:DropDownList></a>
</li>
...ETC
  • 在VB中,当菜单选项为空时,我尝试ddl1.visible=false,但它仍然会在屏幕上留下一个css导致的块。因此我试过这个

    <asp:Panel ID="pnl1" runat="server" Visible="true">
        <li><a style="color:#fff";">
            <asp:DropDownList ID="ddl1" runat="server" style="font-weight: bold; color:#fff;background:#444444; border:0;  text-indent: 5%; text-align-last:center; z-index:-1;" class="fixDDLCategorySize" Height="29px" AutoPostBack="True" OnSelectedIndexChanged="ddl1_SelectedIndexChanged"  >
            </asp:DropDownList></a>
        </li>
    </asp:Panel>
    
    
    
  • 我猜是样式表中的css将更改应用于
  • 的外观。因此,在不改变这一点的情况下,我希望有一种方法可以解决这个问题。不要认为你应该在锚点中有一个下拉列表——这不是有效的html