Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Collapse]Scheduler
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Data Binding
    [Expand]Selection
    [Collapse]Customization
     [Expand]Appearance
     [Collapse]Behavior
       How to: Prevent End-Users from Editing Appointments
       How to: Customize Popup Menu
     [Expand]Custom Forms and Custom Fields
    [Expand]Printing and Reporting
    [Expand]Miscellaneous
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

How would you rate this topic?​​​​​​​