Skip to main content

RichEditCommands.insertContentFromServer Property

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


readonly insertContentFromServer: InsertContentFromServerCommand

Property Value

Type Description

An object that provides methods that execute the command and check its state.


Call the execute(requestId) method to invoke the command. The method checks the command state (obtained via the getState method) to determine whether the action can be performed.

The command triggers the server-side 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 Result parameter as it is demonstrated in the code example below:

<dx:ASPxButton runat="server" ID="InsertText" Text="Insert Text">
    <ClientSideEvents Click="onInsertTextClick" />
<dx:ASPxButton runat="server" ID="InsertModel" Text="Insert Model">
    <ClientSideEvents Click="onInsertModelClick" />
<dx:ASPxRichEdit ID="ASPxRichEdit1" ClientInstanceName="richEdit" runat="server" 
    WorkDirectory="~\App_Data\WorkDirectory" OnInsertContentToClient="ASPxRichEdit1_InsertContentToClient">
function onInsertTextClick() {
    richEdit.commands.insertContentFromServer.execute('text', 0,;
function onInsertModelClick() {
    richEdit.commands.insertContentFromServer.execute('model', 0,;
protected void ASPxRichEdit1_InsertContentToClient(object sender, DevExpress.Web.ASPxRichEdit.InsertContentToClientEventArgs e) {
    if (e.RequestId == "text") {
        e.Result = "Text To Insert";
    if (e.RequestId == "model") {
        var docServer = new RichEditDocumentServer();
        var document = docServer.Document;

        document.AppendText("Model To Insert");
        DocumentRange myRange = document.Paragraphs[0].Range;
        CharacterProperties charProps = document.BeginUpdateCharacters(myRange);
        charProps.FontSize = 30;
        charProps.Bold = true;
        e.Result = document;

Refer to the following section for more information: Client Commands.

See Also