Skip to main content

SchedulerSettings.PopupMenuShowing Property

Enables you to intercept popup menu creation and modify the menu as required or cancel the action.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public PopupMenuShowingEventHandler PopupMenuShowing { get; set; }

Property Value

Type Description
PopupMenuShowingEventHandler

A PopupMenuShowingEventHandler delegate method allowing you to implement custom processing.

Remarks

You can customize the popup menu by handling the SchedulerSettings.PopupMenuShowing event. The code for the Scheduler Partial view that illustrates this technique is shown below. It contains an event handler that inserts a new menu item and specifies a client-side event handler for the click menu action. The JavaScript code for the click event analyzes the name of the item being clicked and calls a custom script or executes a command.

A callback command is created and executed by calling the RaiseCallback scripting function of the ASPxClientScheduler. Common calback commands are described in the Callback Commands document.

@using Scheduler.PopupMenuShowing.Models

@Html.DevExpress().Scheduler(
    settings =>
    {
        settings.Name = "scheduler";
        settings.CallbackRouteValues = new { Controller = "Home", Action = "SchedulerPartial" };
        settings.Width = 800;
        settings.Start = new DateTime(2010, 7, 13);

        settings.Storage.EnableReminders = false;
        settings.Storage.Appointments.Assign(SchedulerHelper.AppointmentStorage);
        settings.Storage.Resources.Assign(SchedulerHelper.ResourceStorage);

        settings.OptionsCustomization.AllowAppointmentCreate = UsedAppointmentType.None;
        settings.OptionsCustomization.AllowAppointmentEdit = UsedAppointmentType.None;
        settings.OptionsCustomization.AllowAppointmentDelete = UsedAppointmentType.None;
        settings.PopupMenuShowing = (sender, e) =>
        {
            if (!e.Menu.MenuId.Equals(SchedulerMenuItemId.DefaultMenu))
                return;
            var item = new MenuItem("Show Resources", "ShowResources");
            e.Menu.Items.Insert(0, item);
            e.Menu.ClientSideEvents.ItemClick = "OnMenuClick";
        };
    }).Bind(Model.Appointments, Model.Resources).GetHtml()
See Also