Making a .NET 2.0 Menu item not selectable

Posted on 2006-05-04
Last Modified: 2008-01-09
I am trying to use the .NET 2.0 menu component, and have one small problem.
I am trying to disable the user from selecting an item in the static menu, but cannot figure out how.

I have a horizontal menu with dropdowns. To do so, I have one row of items (Static Menu) which always are there, and different dropdowns (DynamicMenus) which appear when I hover over items in the Static Menu.

I want to make the items in my Static menu not selectable - because I have no URLs / pages associated with them. They are just categories of items. However, I want to have the dropdowns appear when I hover over them.

Unfortunately, I cannot figure out how to disable the selection of the static menu items, while still making the dropdowns appear. I found one control (I cannot find it now) that set the items enabled property to false, but then none of the dynamic menus appeared.

Here is my code. Thanks,



        With Menu1

            'Menu Configuration
            .Orientation = Orientation.Horizontal
            .DisappearAfter = 1000
            .MaximumDynamicDisplayLevels = 10
            .StaticDisplayLevels = 1

            'General Formatting            
            .Font.Size = 10

            ' Static Menu Formatting
            .StaticMenuStyle.BackColor = Drawing.Color.FromArgb(23, 54, 117)
            .StaticMenuItemStyle.ForeColor = Drawing.Color.White
            .StaticMenuItemStyle.Width = 100
            .StaticMenuItemStyle.BorderColor = Drawing.Color.White
            .StaticMenuItemStyle.BorderWidth = 1
            .StaticMenuItemStyle.BorderStyle = BorderStyle.Solid
            .StaticMenuItemStyle.ItemSpacing = 0
            .StaticMenuItemStyle.HorizontalPadding = 5
            .StaticHoverStyle.Font.Bold = True
            .StaticHoverStyle.ForeColor = Drawing.Color.Yellow
            .StaticEnableDefaultPopOutImage = False
            'Dynamic Menu Formatting
            .DynamicMenuStyle.BackColor = Drawing.Color.White
            .DynamicMenuStyle.ForeColor = Drawing.Color.FromArgb(23, 54, 117)
            .DynamicMenuStyle.BorderColor = Drawing.Color.FromArgb(23, 54, 117)
            .DynamicMenuStyle.BorderWidth = 1
            .DynamicMenuStyle.BorderStyle = BorderStyle.Solid
            .DynamicMenuStyle.Width = 100
            .DynamicMenuItemStyle.HorizontalPadding = 5
            .DynamicBottomSeparatorImageUrl = "images/separator.gif"
            .DynamicHoverStyle.BackColor = Drawing.Color.FromArgb(23, 54, 117)
            .DynamicHoverStyle.Font.Bold = True
            .DynamicHoverStyle.ForeColor = Drawing.Color.Yellow
        End With
Question by:pbissegger
    1 Comment
    LVL 5

    Accepted Solution

    set the selectable = false for each item in your static item collection, its not in the style

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now