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);
}
/*******************************************************/