[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements
   [Expand]Visual Elements
   [Expand]Design-Time Features
    [Expand]Data Binding
       How to: Prevent End-Users from Editing Appointments
       How to: Customize Popup Menu
     [Expand]Custom Forms and Custom Fields
    [Expand]Printing and Reporting
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Customize Popup Menu

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E291.

The page called DefaultItemWithCustomAction illustrates how to change the default action assigned to a menu item. It uses two different techniques to modify the existing menu.

One technique involves a JavaScript function defined in the page markup that replaces the default GoTo command with a custom handler. The ASPxScheduler.PopupMenuShowing event is handled to specify a JavaScript handler.

Another technique implements a CustomMenuViewCallbackCommand command that is used to perform a callback. The ASPxScheduler.BeforeExecuteCallbackCommand event should be handled to process the command. The ASPxScheduler.PopupMenuShowing event is handled to rename a menu item so it can be properly recognized by a custom callback command.

The code in the event handler changes the MenuItem.Name of the default New Appointment menu item to "MyNewAppointment" on the client side. The MenuItem.Text string that is displayed is changed to "Instant Appointment". So, the popup menu displays the "Instant Appointment" text instead of the default text for the "New Appointment" command. When the user selects this item, a "MyNewAppointment" string is passed as a menu identifier to a callback command.


Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E291.

To implement a new custom callback command, create a new class named CustomMenuViewCallbackCommand, which inherits from the DevExpress.Web.ASPxScheduler.Internal.MenuViewCallbackCommand class. The required functionality is implemented by overriding the ParseParameters and the ExecuteCore methods of the base class.

The code snippet below creates a new appointment in the selected interval with the "Busy" label (the Appointment.LabelId property is set to 1) and "Free" status (the Appointment.StatusId is set to the AppointmentStatusType.Busy value). This action is performed for menu items with the MenuItem.Name equal to "MyNewAppointment". Use the ASPxScheduler.PopupMenuShowing event to set a menu item name.

To execute a custom callback command when the user clicks an item in the popup menu, handle the ASPxScheduler.BeforeExecuteCallbackCommand event and specify a custom callback command for the "MNUVIEW" value of the SchedulerCallbackCommandEventArgs.CommandId arguments property.

Is this topic helpful?​​​​​​​