The demo shows how to build context menu dynamically by client java script code.
An appropriate scheduler items have linked the same context menu object. However,
before the menu is shown the MenuBox.MenuActivate event is fired and the
content of menu is modified. In this example the itemContextMenu_MenuActivate
method handles the MenuActivate event. There are few client methods, like
Clear, AddItem, AddSeperator designed for emitting new content
of menu.
Another thing you can test here is a command handling. The menu commands are fired
just after user clicks any menu items. The MenuBox.Command event is designed
for this purpose. In this example, there are two handler methods:
- the client, java script ‘function itemContextMenu_Command’ method,
which is fired first in the web browser,
- and the second ‘void ItemContextMenu_Command’ method, which is fired at the
server code afterwards.
The client handler displays an alert window for certain menu items that are marked
by ‘client alert’ command name. In order to deny following handling of event
by the server code, the Cancel argument has to be set. The first menu item
is ignored by the client handler and is passed follow to the server handler, which
sets the label control with scheduler item name. Notice, the page is build of MS
AJAX panel that allows updating two controls, scheduler and label, at the
same time in one server request.