Skip to main content

How to: Customize Popup Menu

  • 4 minutes to read


Example 1

The code sample below demonstrates how to customize a popup menu item and change the default action assigned to a menu item.

function DefaultViewMenuHandler(scheduler, s, args) {
    if (args.item.GetItemCount() <= 0) {
        if ( == "GotoToday") {
            if (window.confirm("Are you realy want to leave this day?")) {
                scheduler.RaiseCallback("GOTODAY|" +;
            scheduler.RaiseCallback("MNUVIEW|" +;
using DevExpress.Web;
using DevExpress.Web.ASPxScheduler;
using DevExpress.XtraScheduler;
    protected void ASPxScheduler1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
        ASPxSchedulerPopupMenu menu = e.Menu;
        if (menu.MenuId.Equals(SchedulerMenuItemId.DefaultMenu)) {
            menu.ClientSideEvents.ItemClick = String.Format("function(s, e) {{ DefaultViewMenuHandler({0}, s, e); }}", ASPxScheduler1.ClientInstanceName);
            MenuItemCollection menuItems = menu.Items;
            MenuItem defaultItem = menuItems.FindByName("NewAppointment");
            defaultItem.Name = "MyNewAppointment";
            defaultItem.Text = "Instant Appointment";

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.LabelKey property is set to 1) and “Free” status (the Appointment.StatusKey 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.

View Example

using DevExpress.Web;
using DevExpress.Web.ASPxScheduler;
using DevExpress.XtraScheduler;
    protected void ASPxScheduler1_BeforeExecuteCallbackCommand(object sender, SchedulerCallbackCommandEventArgs e) {
        if(e.CommandId == "MNUVIEW")
            e.Command = new CustomMenuViewCallbackCommand(ASPxScheduler1);
public class CustomMenuViewCallbackCommand : DevExpress.Web.ASPxScheduler.Internal.MenuViewCallbackCommand {
    string menuItemName;

    public CustomMenuViewCallbackCommand(ASPxScheduler control)
        : base(control) {

    public string MenuItemName { get { return menuItemName; } }

    protected override void ParseParameters(string parameters) {
        this.menuItemName = parameters;
    protected override void ExecuteCore() {
    protected internal virtual void ExecuteUserMenuCommand(string MenuItemName) {
        if(MenuItemName == "MyNewAppointment")
            CreateAppointment("New Appointment", AppointmentStatusType.Free, 1);
    protected void CreateAppointment(string subject, AppointmentStatusType statusType, int labelId) {
        Appointment apt = Control.Storage.CreateAppointment(AppointmentType.Normal);
        apt.Subject = subject;
        apt.Start = Control.SelectedInterval.Start;
        apt.End = Control.SelectedInterval.End;
        apt.ResourceId = Control.SelectedResource.Id;
        apt.StatusKey = (int)statusType;
        apt.LabelKey = labelId;