Scheduler: Context Menu

The Scheduler can show a context menu for common objects:
- Events (ContextMenu property)
- Resource Header (ContextMenuResource property)
- Time Range Selection (ContextMenuSelection property)
You need to create the context menu using a special control (DayPilotMenu) and assign it to the appropriate property.
Activating the Context Menu
For right click on resource header, time range, and events the context menu is activated automatically just by setting the ContextMenu* property (see above).
You can also activate it for left click on events using:
EventClickClickHandling="ContextMenu"
Custom Event Context Menu
It is possible to assign a custom context menu for each event individually using BeforeEventRender handler.
- Each custom menu must be created as a special object (DayPilotMenu control).
- You should specify ClientObjectName for each special menu control.
- Assign the context menu (using its ClientObjectName) to the event using e.ContextMenuClientName property in the event handler
Example
.aspx
<DayPilot:DayPilotMenu ID="DayPilotMenuSpecial" runat="server" ClientObjectName="cmSpecial" CssClassPrefix="menu_"
>
<DayPilot:MenuItem Text="Open" Action="JavaScript" JavaScript="alert('Opening event (id ' + e.value() + ')');">
</DayPilot:MenuItem>
<DayPilot:MenuItem Text="Send" Action="JavaScript" JavaScript="alert('Sending event (id ' + e.value() + ')');">
</DayPilot:MenuItem>
<DayPilot:MenuItem Text="Delete (JavaScript using callback)" Action="JavaScript"
Command='Delete' JavaScript="if (confirm('Do you really want to delete event ' + e.text() + ' ?')) dps1.eventMenuClickCallBack(e, command);">
</DayPilot:MenuItem>
</DayPilot:DayPilotMenu>.aspx.cs
protected void DayPilotScheduler1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.BeforeEventRenderEventArgs e)
{
if (e.Value == "11")
{
e.ContextMenuClientName = "cmSpecial";
}
}See Also