ASPxScheduler.PreparePopupMenu Event
OBSOLETE
You should use the 'PopupMenuShowing' instead
Occurs before a context menu is created for a scheduler.
Namespace: DevExpress.Web.ASPxScheduler
Assembly: DevExpress.Web.ASPxScheduler.v24.1.dll
NuGet Package: DevExpress.Web.Scheduler
Declaration
[Obsolete("You should use the 'PopupMenuShowing' instead", false)]
public event PreparePopupMenuEventHandler PreparePopupMenu
Event Data
The PreparePopupMenu event's data class is PreparePopupMenuEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Menu | Gets the popup menu for which this event was raised. Inherited from PopupMenuShowingEventArgs. |
Remarks
Handle the PreparePopupMenu event to modify items in the context menu. The current context menu can be accessed via the PopupMenuShowingEventArgs.Menu property.
Example
The following example illustrates how to handle the PreparePopupMenu event for customizing a context menu.
protected void ASPxScheduler1_PreparePopupMenu(object sender,
PreparePopupMenuEventArgs e)
{
ASPxSchedulerPopupMenu menu = e.Menu;
DevExpress.Web.MenuItemCollection menuItems = menu.Items;
// Check whether this menu is invoked by clicking empty time cells
if (menu.Id == SchedulerMenuItemId.DefaultMenu) {
// Remove the "New Appointment" item
DevExpress.Web.MenuItem item = menuItems.FindByName("NewAppointment");
if(item != null) menuItems.Remove(item);
// Create a group and add two submenus
DevExpress.Web.MenuItem newItem =
new DevExpress.Web.MenuItem("CreateNewEvent", "TemplateEvents");
newItem.BeginGroup = true;
menuItems.Insert(0, newItem);
newItem.Items.Add(new DevExpress.Web.MenuItem("Check engine oil",
"CheckEngineOilId"));
newItem.Items.Add(new DevExpress.Web.MenuItem("Wash the car",
"WashCarId"));
}
}
See Also