ToolbarComboBox Class
Implements a combo box custom toolbar item functionality.
Namespace: DevExpress.Web.ASPxHtmlEditor
Assembly: DevExpress.Web.ASPxHtmlEditor.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Remarks
The ToolbarComboBox class allows you to provide the ASPxHtmlEditor toolbar with custom combo box items.
Properties provided by the ToolbarComboBox class allow you to customize the item appearance and behavior.
- ToolbarComboBox.Items. Use this collection to add items to a dropdown list.
- ToolbarComboBoxBase.DefaultCaption. Use this property to provide a text to be displayed within the edit box of a combo box when none of its items are selected.
- ToolbarComboBox.CommandName. Use this property to associate a command name with a combo box. You can use this command name to respond to selecting combo box items on the client side via the editor’s ASPxClientHtmlEditor.CustomCommand client event handler.
- ToolbarComboBox.PropertiesComboBox. Provides a number of appearance and behavior options that are common to all combo box editors.
Example
This example demonstrates how to create a custom toolbar with different types of custom toolbar items in the ASPxHtmlEditor.
A toolbar item’s CommandName property specifies the name of the command that is executed by this item. The custom command logic is implemented in the ASPxClientHtmlEditor.CustomCommand event handler.
function OnCommandExecute(s, e) {
var value = e.parameter;
switch (e.commandName) {
case "InsertTemplate":
InsertTemplate(value);
break;
case "InsertSmiley":
InsertSmiley(value);
break;
case "InsertCustomer":
InsertCustomer(value);
break;
case "DeleteAll":
s.SetHtml(' ');
break;
}
}
function InsertTemplate(value) {
HtmlEditor.GetSelection().SetHtml(value + " ");
}
function InsertSmiley(value) {
var selection = HtmlEditor.GetSelection();
var valueInfo = value.split("#");
selection.SetHtml("<img style='margin-bottom:-2px;' src='../Content/Smilies/" + valueInfo[0] + ".png' alt='" + valueInfo[2] + "' title='" + valueInfo[1] + "' />");
}
function InsertCustomer(value) {
HtmlEditor.GetSelection().SetHtml(value);
}