search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Dynamic Context Menu for events

Asked by Nilesh
10 years ago.

I want to display different context menu for my events. I want this menu to be generated dynamically. How can I achive this??? I am using DayPilot 5.6

Comment posted by Dan Letecky
10 years ago.

There is no way to generate the context menu on the fly (at least for now).

You have two options:

  • Create several context menus that cover the possible cases. You can assign the context menu for each event separately using BeforeEventRender event handler (see also DayPilot Calendar: Context Menu).
  • You can use DayPilot Bubble control instead of the menu. The bubble content (HTML) is generated on the fly. You can use anything that HTML supports (images, tables, hyperlinks). The bubble can be activated upon event click, right-click, hover, etc.
Comment posted by Nilesh Upadhyay
9 years ago.

Can I create runtime Menu and Menuitems ? Like Following:

 I am writing a method called DynamicMenu conatains following code and it will execute from getData method of DayPilotMonth.The following code give me error like :   The control collection cannot be modified during DataBind, Init, Load,  PreRender or Unload phases  Is there any event in which I can create Dynamic Menu n MenuItems Like this..

/*********************************************************/

public void DynamicMenu(eventID,menuText,MenuCommandText)

{

// Event ID is increment counter for different menuId.

DayPilotMenu menuList = new DayPilotMenu();
menuList.ID = "DayPilotMenu_" + eventId;

DayPilot.Web.Ui.MenuItem menuItem = new DayPilot.Web.Ui.MenuItem();
menuItem.Text = menuText;
menuItem.Command = menuCommandText;
menuItem.Action = DayPilot.Web.Ui.MenuItemAction.PostBack;

menuList.MenuItems.Add(menuItem);
Page.Controls.Add(menuList);

}

/*******************************************************/

This question is more than 6 months old and has been closed. Please create a new question if you have anything to add.