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

Is it possible to ddd DayPilot:MenuItem items at runtime ?

Asked by peter cli
15 years ago.

I'd like to add menu items to a DayPilot:DayPilotMenu at run-time in my c# codebehind.

For example, right click an event, andsay "add subitem x"

Is that possible ?

Thanks, Peter

Comment posted by Dan Letecky
15 years ago.
That's no problem. You can do it this way:

MenuItem item = new MenuItem();
item.Text = "Delete";
item.Action = MenuItemAction.CallBack;
item.Command = "delete";
Comment posted by Anonymous
15 years ago.

Thanks Dan.

This puts menu items into all events.

Is there any way to control which event gets the menu item ?


Answer posted by Dan Letecky
15 years ago.
You can assign an event-specific context menu in BeforeEventRender event (e.ContextMenuClientName; should be equal to DayPilotMenu.ClientObjectName).

The method of dynamic menu creation from my previous post doesn't allow you to add/remove items during CallBacks/partial PostBacks (only full PostBacks). BeforeEventRender will allow you to create several menus and assign them as needed. Most likely, you won't need a different menu for each event but there will be just a few types of menus based on event type anyway.
Comment posted by Anonymous
14 years ago.
I am experiencing a similar situation (different types of events that need different menus) and thought that this was the best solution. The problem is I am working with the month view calendar. The BeforeEventRenderEventArgs are much more limited for the month view and does not include ContextMenuClientName. Is there another way to accomplish this, or would it be possible to enable this in a future release?
Comment posted by Dan Letecky
14 years ago.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.