Skip to main content

ASPxClientHtmlEditor.CreateChangeMediaElementCommandArguments(element) Method

Creates a parameter for ASPxHtmlEditor‘s client-side commands related to changing media elements.

Declaration

CreateChangeMediaElementCommandArguments(
    element: any
): ASPxClientHtmlEditorChangeMediaElementCommandArguments

Parameters

Name Type Description
element any

An element that is being changed.

Returns

Type Description
ASPxClientHtmlEditorChangeMediaElementCommandArguments

An ASPxClientHtmlEditorChangeMediaElementCommandArguments object which contains the current settings of the changed element.

Remarks

When executed manually, ASPxHtmlEditor‘s client-side commands related to changing media elements (Audio, Video, Flash, etc.) require specific parameters. These parameters are descendants of the ASPxClientHtmlEditorChangeMediaElementCommandArguments class and don’t have public constructors. To create a parameter, pass the element you’re about to change as an element parameter to the CreateChangeMediaElementCommandArguments method. It creates an object containing properties of the passed media element. Then, you can change the required properties and pass the resulting parameter to the ASPxClientHtmlEditor.ExecuteCommand method.

// Changing the selected flash element's dimensions and alignment
var flash = htmlEditor.GetSelection().GetSelectedElement();
var args = htmlEditor.CreateChangeMediaElementCommandArguments(flash);
args.align = "center";
args.styleSettings.width = "400px";
args.styleSettings.height = "100px";
htmlEditor.ExecuteCommand(args.GetCommandName(), args);
See Also