Custom Dialogs
- 2 minutes to read
In addition to built-in dialogs available in ASPxHtmlEditor, you can use any number of custom dialogs, which can be easily added at both design and runtime.
To add custom dialogs to an editor, use its ASPxHtmlEditor.CustomDialogs collection. A custom dialog is represented by an HtmlEditorCustomDialog object, which provides the following settings.
- HtmlEditorCustomDialog.Caption and HtmlEditorCustomDialog.Name. Use these properties to specify a dialog’s caption and name. The dialog’s name is used for reference, as described below.
- HtmlEditorCustomDialog.FormPath. Use this property to provide a path to a user control representing a dialog form.
- HtmlEditorCustomDialog.OkButtonText, HtmlEditorCustomDialog.OkButtonVisible, HtmlEditorCustomDialog.CancelButtonText, and HtmlEditorCustomDialog.CancelButtonVisible. These properties allow you to specify the visibility and caption of two standard dialog buttons. By default, these buttons are labeled “OK” and “Cancel”. You can customize default button captions as necessary.
You can associate a custom dialog with a toolbar item, which when clicked, invokes the dialog. To accomplish this, add a ToolbarCustomDialogButton toolbar item to ASPxHtmlEditor and assign the dialog’s name to the toolbar item’s ToolbarCustomDialogButton.Name property.
Custom Dialog Events
ASPxHtmlEditor provides you with the following events that allow you to respond to end-user interactions with custom dialogs and dialog button clicks on the client side.
Event | Description |
---|---|
ASPxClientHtmlEditor.CustomDialogOpened | Handle this event to initialize a custom dialog. |
ASPxClientHtmlEditor.CustomDialogClosing | Handle this event to respond to closing a custom dialog (initiated by a click on a dialog button or the header’s close button). |
ASPxClientHtmlEditor.CustomDialogClosed | Handle this event to perform specific actions, based upon the dialog button that has been clicked or any other suitable condition. |