Web 2.0 Submenus

Not sure what I am doing wrong here. I’m trying to create a sub menu called OPI with the sub-menu items in it. Can anyone help with what I’m doing wrong here or with an example of creating a sub-menu? Here’s my code:

Dim FileMenu As New WebToolbarButton
FileMenu.Style = WebToolbarButton.ButtonStyles.Menu
FileMenu.Caption = "File"

FileMenu.Menu.AddMenuItem(New WebMenuItem("Change Fiscal Year"))
FileMenu.Menu.AddMenuItem(New WebMenuItem("Change School"))
FileMenu.Menu.AddMenuItem(New WebMenuItem("-"))

Dim OPISubMenu As New WebToolbarButton("OPI")
OPISubMenu.Style = WebToolbarButton.ButtonStyles.Menu

OPISubMenu.Menu.AddMenuItem(New WebMenuItem("Send Terms of Employment"))
OPISubMenu.Menu.AddMenuItem(New WebMenuItem("Send Compensation Expenditures"))
OPISubMenu.Menu.AddMenuItem(New WebMenuItem("Send MAEFAIRS Report"))


Any ideas?

Var FileMenu As New WebMenuItem("File")

FileMenu.AddMenuItem(New WebMenuItem("Change Fiscal Year"))
FileMenu.AddMenuItem(New WebMenuItem("Change School"))
FileMenu.AddMenuItem(New WebMenuItem("-"))

Var OPISubmenu As New WebMenuItem("OPI")
OPISubmenu.AddMenuItem("Send Terms of Employment")
OPISubmenu.AddMenuItem("Send Compensation Expenditures")
OPISubmenu.AddMenuItem("Send MAEFAIRS Report")


Var myButton As New WebToolbarButton
myButton.Style = WebToolbarButton.ButtonStyles.Menu
myButton.Menu = FileMenu
myButton.Caption = "File"


You can do without the extra Filemenu.Menu.AddMenuItem etc. In the end you create a Button and bind the menu to this button. Last step is to add this Button to the Buttonbar…

This code is in the Opening event of the Buttonbar


Awesome! Thank you so much!