简体   繁体   English

需要帮助在asp.net中为菜单项创建下拉菜单

[英]Need help creating dropdown for menu item in asp.net

I have a unordered list created for my menu that was automatically created by visual studios create web form template that I have been adding to as I go along. 我为菜单创建了一个无序列表,该列表是由Visual Studio创建的Web表单模板自动创建的。 My problem is that now I have one specific link that I would like to have dropdown to other links but I cant for the life of me figure out the easiest way to do it. 我的问题是,现在我有一个特定的链接,希望将其下拉至其他链接,但我终生无法找出最简单的方法。

Here's the code for the menu links from Site.master: 这是Site.master菜单链接的代码:

     <nav>
           <ul id="menu">
                <li><a runat="server" href="~/">Home</a></li>
                <li><a runat="server" href="~/About.aspx">About</a></li>                        
                <li><a runat="server" href="~/Pricing.aspx">Pricing</a></li>
                <li><a runat="server" href="VideoTransfer.aspx">Video Transfer</a></li>                     
                <li><a runat="server"href="~/Testimonials.aspx">Testimonials</a</li>
                <li><a runat="server" href="~/Contact.aspx">Contact</a></li>
           </ul>
     </nav>

I'm trying to get "Video Transfer" and a couple other links I will later create, to appear as a vertical dropdown menu navigation of "Pricing" when a user hovers over "Pricing". 我正在尝试获取“视频传输”和以后将创建的其他几个链接,以在用户将鼠标悬停在“定价”上时显示为“定价”的垂直下拉菜单导航。

Here is the relevant CSS from Site.css: 这是Site.css中的相关CSS:

/* menu
----------------------------------------------------------*/
ul#menu {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 5px;
    padding: 0;
    text-align: right;
}

    ul#menu li {
        display: inline;
        list-style: none;
        padding-left: 15px;
    }

        ul#menu li a {
            background: none;
            color: #999;
            text-decoration: none;
        }

        ul#menu li a:hover {
            color: #333;
            text-decoration: none;
        }

Any help would be greatly appreciated!! 任何帮助将不胜感激!! Thanks!! 谢谢!!

 <asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="3">
  <Items>
   <asp:MenuItem Text="File" Value="File">
    <asp:MenuItem Text="New" Value="New"></asp:MenuItem>
    <asp:MenuItem Text="Open" Value="Open"></asp:MenuItem>
   </asp:MenuItem>

   <asp:MenuItem Text="Edit" Value="Edit">
    <asp:MenuItem Text="Copy" Value="Copy"></asp:MenuItem>
    <asp:MenuItem Text="Paste" Value="Paste"></asp:MenuItem>
   </asp:MenuItem>

   <asp:MenuItem Text="View" Value="View">
    <asp:MenuItem Text="Normal" Value="Normal"></asp:MenuItem>
    <asp:MenuItem Text="Preview" Value="Preview"></asp:MenuItem>
   </asp:MenuItem>
  </Items>
 </asp:Menu>

Try this for Menu control.. You can change the orientation of the Menu control in the properties. 对菜单控件尝试此操作。您可以在属性中更改菜单控件的方向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM