DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » How To » How do I show context menu on Highlight event?

How do I show context menu on Highlight event?

I would like to show context menu when use click somewhere, is it possible?
Alex - 9/26/2007 7:22:23 PM
Yes, it's possible.

The context menu is available in the following scenarios:

1. On right click on a time range selection (including right-clicking somewhere)
You have to set TimeRangeSelectedHandling="Hold" and assign the context menu to ContextMenuSelectionID.

2. On right-clicking an event
Just assign ContextMenuID for global context menu (for all events). You can set context menu for each event individually in BeforeEventRender event handler.

3. Invoke context menu manually
Use menu1.show(e) method where "menu1" is ClientObjectName of the menu and e is the DayPilotCalendar.Event/DayPilotScheduler.Event object (available in client-side event handlers as "e").
Dan Letecky - 9/26/2007 8:33:54 PM
Thanks for quick replay Dan. Actualy I just want to be able to see context menu on TimeRangeSelectedHandling when user click somewhere in calendar and if I use JavaScript with script like: dpc.show(e) I get error about that 'e' is undefined?
Alex - 9/27/2007 3:51:26 PM
I'm also facing the same problem. I use the TimeRangeSelectedHandling="JavaScript" in conjunction with TimeRangeSelectedJavaScript="menuCreate.show(e)" where menuCreate is the clientobjectname of the contextmenu and i'm getting the same error." e is undefined."
giamix - 10/19/2007 12:00:04 PM
Alex,
Sorry for a late response.

Alex, giamix,
e is not valid in this context (it holds the Event object for event-related user actions). For time-range related context menu you should supply the Selection object which you can get using dpc.getSelection(). So it should look like this:

menuCreate.show(dpc.getSelection())

Where dpc is the value of DayPilotCalendar.ClientObjectName property. Let me know if you have troubles with this code.
Dan Letecky - 10/19/2007 12:44:54 PM
Post reply