InsertContentFromServerCommand.execute(requestId) Method
Executes the InsertContentFromServerCommand command with the specified parameters.
Declaration
execute(
requestId: string,
position?: number,
subDocumentId?: number
): boolean
Parameters
Name | Type | Description |
---|---|---|
requestId | string | An integer value identifying the request to the server. |
position | number | An integer value specifying position where to insert content to the active sub-document. |
subDocumentId | number | An integer value identifying the target sub-document. |
Returns
Type | Description |
---|---|
boolean | true if the command has been successfully executed; false if the command execution has failed. |
Remarks
The command triggers the server-side ASPxRichEdit.InsertContentToClient event. Use its handler to create a server-side model via the RichEditDocumentServer class (see Word Processing Document API) and pass it to the client using the InsertContentToClientEventArgs.Result parameter as demonstrated in the code example below:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function onInsertTextClick() {
richEdit.commands.insertContentFromServer.execute('text', 0, richEdit.document.mainSubDocument.id);
}
function onInsertModelClick() {
richEdit.commands.insertContentFromServer.execute('model', 0, richEdit.document.mainSubdocument.id);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxButton runat="server" ID="InsertText" Text="Insert Text">
<ClientSideEvents Click="onInsertTextClick" />
</dx:ASPxButton>
<dx:ASPxButton runat="server" ID="InsertModel" Text="Insert Model">
<ClientSideEvents Click="onInsertModelClick" />
</dx:ASPxButton>
<dx:ASPxRichEdit ID="ASPxRichEdit1" ClientInstanceName="richEdit" runat="server" WorkDirectory="~\App_Data\WorkDirectory" OnInsertContentToClient="ASPxRichEdit1_InsertContentToClient">
</dx:ASPxRichEdit>
</div>
</form>
</body>
</html>
See Also