You can specify the menu items using Items/MenuItems property.
See also the list of supported menu actions.
ASP.NET WebForms
.aspx
<daypilot:daypilotmenu id="DayPilotMenu1" runat="server" ClientObjectName="menu"> <DayPilot:MenuItem Text="Open" Action="JavaScript" JavaScript="alert('Opening event (id ' + e.value() + ')');" ></DayPilot:MenuItem> <DayPilot:MenuItem Text="-" Action="NavigateUrl" ></DayPilot:MenuItem> <DayPilot:MenuItem Text="Delete (CallBack)" Action="CallBack" Command="Delete"></DayPilot:MenuItem> <DayPilot:MenuItem Action="PostBack" Command="Delete" Text="Delete (PostBack)" /> <DayPilot:MenuItem Text="Delete (JavaScript using callback)" Action="JavaScript" Command='Delete' JavaScript="if (confirm('Do you really want to delete event ' + e.text() + ' ?')) ctl00_ContentPlaceHolder1_DayPilotCalendar1.eventMenuClickCallBack(e, command);"></DayPilot:MenuItem> </daypilot:daypilotmenu>
Code behind (C#)
protected void Page_Load(object sender, EventArgs e) { DayPilotMenu1.MenuItems.Clear(); // <DayPilot:MenuItem Text="Open" Action="JavaScript" JavaScript="edit(e);" ></DayPilot:MenuItem> MenuItem open = new MenuItem(); open.Text = "Open"; open.Action = MenuItemAction.JavaScript; open.JavaScript = "edit(e);"; DayPilotMenu1.MenuItems.Add(new MenuItem()); // ... }
ASP.NET MVC
@Html.DayPilotMenu("menu1", new DayPilotMenuConfig { Items = new DayPilot.Web.Mvc.MenuItemCollection() { new DayPilot.Web.Mvc.MenuItem { Text = "Open", Action = MenuItemAction.JavaScript, JavaScript = "alert(e.value());"}, new DayPilot.Web.Mvc.MenuItem { Text = "Delete", Action = MenuItemAction.CallBack, Command = "Delete"} } })
JavaScript
dp.contextMenu = new DayPilot.Menu({ items: [ {text:"Show event ID", onclick: function() {alert("Event value: " + this.source.value());} }, {text:"Show event text", onclick: function() {alert("Event text: " + this.source.text());} }, {text:"Show event start", onclick: function() {alert("Event start: " + this.source.start().toStringSortable());} }, {text:"Delete", onclick: function() { dp.events.remove(this.source); } } ]});