Skip to main content
A newer version of this page is available. .
cut

RichEditCommands.insertContentFromServer Property

Gets a command to insert content created on the server to the client model.

Declaration

readonly insertContentFromServer: InsertContentFromServerCommand

Property Value

Type Description
InsertContentFromServerCommand

A InsertContentFromServerCommand object that provides methods for executing the command and checking its state.

Remarks

You can invoke this command by calling the execute method.

The execute method checks the command state (obtained using the getState method) before executing, and decides whether the action can be performed. The execute and getState methods are members of the InsertContentFromServerCommand class.

The command triggers the server-side ASPxRichEdit.InsertContentToClient event. Use its handler to create a server-side document’s model via the RichEditDocumentServer class (see Word Processing Document API) and pass it to the client using the InsertContentToClientEventArgs.Result parameter as it is 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');
        }
        function onInsertModelClick() {
            richEdit.commands.insertContentFromServer.execute('model');
        }
    </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>

Use the insertContentFromServer‘s overloads to specify a location where to insert the content.

See Also