The ASP.NET MVC Rich Text Editor enables you to customize its context menu. By handling the PopupMenuShowing client-side event, you can perform the following actions with the ASPxRichEdit's context menu
- Manipulate menu items - add new items, remove or disable existing ones (use the menuItems property);
- Prevent the context menu from being displayed (use the cancel property).
In this demo, the PopupMenuShowing event is handled to illustrate the context menu customizing capabilities. Using check boxes, you can switch the context menu availability (via cancel) and control whether to clear or retain the default menu items when populating the menu with custom items (via e.menuItems). The custom items are implemented as ASPxClientRichEditPopupMenuItem objects by their name property. Clicks on custom menu items are processed using the CustomCommandExecuted client event. Its handler identifies the activated item by its name and performs the corresponding action on the client-side. In this demo, custom menu items create the Date and Time fields (using the createDateField and createTimeField client commands) and search the selected text in Google (the selected text is received via the Client API).