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

How to disable context menu item via coding in code behind file.

Asked by Amit Prajapati
6 years ago.

Dear Sir,

We are working with demo version of the ASP.NET scheduler for web forms, we are displaying multiple context menu items for the different event displayed on right click. But how can i disable a particular context menu item on some condition like the event is started we cannot start it again and it should come as disabled in context menu item.

Kindly suggest. We are stuck here since last 15 days, and we are not finding any solution for the same.

We want to purchase the same based on how the control can be customized for the context menu items.


Answer posted by requirer
6 years ago.

protected void Scheduler_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)

if (condition)
e.ContextMenuClientName = "DayPilotMenu1";


You can store your condition in e.value example : e.Value.StartsWith("p")

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

See also the documentation on event customization:

The data source object properties can be reached using e.DataItem:

protected void DayPilotScheduler1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
  string type = (string) e.DataItem["type"];
  if (type == "type1") {
    e.ContextMenuClientName = "menu2";

You can also use e.Tag and DataTagFields -> these values will be available even for events restored from ViewState.

You have to define create a new DayPilotMenu object for each menu type. Set the ClientObjectName and use the value for e.ContextMenuClietName.

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