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

Manual add menu item in DayPilotMenu

Asked by Anni Tay
6 years ago.

I understand that DayPilotMenu can be called custom by using ContextMenuClientName in BeforeEventRender.
Of course the menuitem on DayPilotMenu need to be predefined.

Is it possible to add menuitem in the code itself not from the properties?

In my case is, every user have their own menu..
I dont want to create many DayPilotMenu for specified user.. The combination can be a lot..

Thank you..

Answer posted by Dan Letecky [DayPilot]
6 years ago.

You can specify the menu items in the code behind using DayPilotMenu.MenuItems property:

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());
  // ...

}

You can customize the list depending on the current user permissions/roles.

See also:
http://doc.daypilot.org/menu/items/

Comment posted by Anni Tay
6 years ago.

Hi..
Thank you for your reply.. It works...

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