<< Dynamic menu building  >> Show source code for this site
This demo presents a dynamic building of a context menu. Right click at the scheduler item to display the context menu. Selecting first option of the menu fills follows label with caption of scheduler item by using of MS AJAX.

Scheduler item:
choose first option of menu...

Selecting other options displays client alert windows without server request.
Notice, every context menu has different number of items regards to dynamic building of context menu by java script code.

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.


If you would look into a source code for this demo, click on the link.
For demonstration purposes all appointments displayed on a calendar are stored in ASP.NET session objects, so original values are restored immediately after a new session object is created.
A list of appointments and resources is intialized every time a new session is started.