

If (varmaintenanceDropItem = true)// shows services item if there is a item in services that are visible

If (varreportsDropItem = true)// shows services item if there is a item in services that are visible ServicesToolStripMenuItem.Visible = true If (varservicesDropItem = true)// shows services item if there is a item in services that are visible If (varmasterDropItem = true) // shows master item if there is a item in master that are visible If (() = drmaintenance.ToString() & Convert.ToInt32(drmaintenance) = 1) If (() = druseroptions.ToString() & Convert.ToInt32(druseroptions) = 1)įoreach (DataRow drmaintenance in dtDBRoleControl.Rows)įoreach (ToolStripItem maintenanceDropItem in maintenanceToolStripMenuItem.DropDownItems) // use to disable sub items of mastermenu If (() = drreports.ToString() & Convert.ToInt32(drreports) = 1)įoreach (DataRow druseroptions in dtDBRoleControl.Rows)įoreach (ToolStripItem useroptionsDropItem in reportsToolStripMenuItem.DropDownItems) // use to disable sub items of mastermenu If (() = drservices.ToString() & Convert.ToInt32(drservices) = 1)įoreach (DataRow drreports in dtDBRoleControl.Rows)įoreach (ToolStripItem reportsDropItem in reportsToolStripMenuItem.DropDownItems) // use to disable sub items of mastermenu If (() = drmaster.ToString() & Convert.ToInt32(drmaster) = 1)įoreach (DataRow drservices in dtDBRoleControl.Rows)įoreach (ToolStripItem servicesDropItem in servicesToolStripMenuItem.DropDownItems) // use to disable sub items of mastermenu
Menustrip control in asp.net code#
Here is my code public void startUpRoleControl()įoreach(DataRow drmaster in dtDBRoleControl.Rows)įoreach (ToolStripItem masterDropItem in masterToolStripMenuItem.DropDownItems) // use to disable sub items of mastermenu What I want is to loop all items in the MenuStrip level not on submenu level Basically I am looping my SubMenu just to control my items.

My problem is if I add a new SubMenu is I have to input a code to loop it again to control my items.
Menustrip control in asp.net how to#
Provides basic functionality for controls derived from ToolStripItem that display drop-down items when clicked.I've been trying for weeks on how to loop all the items in my SubMenu on the MenuStrip. Represents a control that enables the user to select a single item from a list that is displayed when the user clicks a ToolStripDropDownButton or a higher-level menu item.

Represents a selectable option displayed on a MenuStrip or ContextMenuStrip. The following table shows the important ContextMenuStrip companion classes. The ContextMenuStrip control is designed to work seamlessly with the new ToolStrip and related controls, but you can associate a ContextMenuStrip with other controls just as easily. Shortcut menus provide options for the client area or the control at the mouse pointer location. Shortcut menus, also called context menus, appear at the mouse position when the user clicks the right mouse button. The ContextMenuStrip control replaces and adds functionality to the ContextMenu control however, the ContextMenu control is retained for backward compatibility and future use if you choose.
