Making a .NET 2.0 Menu item not selectable
Posted on 2006-05-04
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,
.Orientation = Orientation.Horizontal
.DisappearAfter = 1000
.MaximumDynamicDisplayLevels = 10
.StaticDisplayLevels = 1
.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