Context Menu Items

Each context menu item can perform one of the following actions:

  • JavaScript
  • NavigateUrl
  • CallBack

JavaScript Action

This action type will execute the JavaScript code set in JavaScript property.

For event context menu, e variable will hold DayPilot.Event object representing the event.

Example

<%= Html.DayPilotMenu("menu", new DayPilotMenuConfig {
  CssClassPrefix = "menu_",
  Items = new DayPilot.Web.Mvc.MenuItemCollection
  {
    new DayPilot.Web.Mvc.MenuItem { Text = "Open", Action = MenuItemAction.JavaScript, JavaScript = "alert(e.value());"}
  }
})
%>

NavigateUrl Action

This action type will navigate to the URL specified using NavigateUrl property (using NavigateUrlTarget as link target). All occurences of  "{0}" string in the URL will be replaced by the event id.

Example

<%= Html.DayPilotMenu("menu", new DayPilotMenuConfig {
  CssClassPrefix = "menu_",
  Items = new DayPilot.Web.Mvc.MenuItemCollection
  {
    new DayPilot.Web.Mvc.MenuItem { Text = "Details", Action = MenuItemAction.NavigateUrl, NavigateUrl = "Event/{0}"}
  }
})
%>

CallBack Action

This action type will execute a server-side event handler using AJAX CallBack:

  • OnEventMenuClick (for events) - supported in CalendarScheduler, and Month
  • OnTimeRangeMenuClick (for time range selection) - supported in Calendar and  Scheduler
  • OnResourceHeaderMenuClick (for resource header) - supported in  Scheduler

You should specify the Command property - it will be available in the server-side event handler.

Example

<%= Html.DayPilotMenu("menu", new DayPilotMenuConfig {
  CssClassPrefix = "menu_",
  Items = new DayPilot.Web.Mvc.MenuItemCollection
  {
    new DayPilot.Web.Mvc.MenuItem { Text = "Delete", Action = MenuItemAction.CallBack, Command = "Delete"}
  }
})
%>