Skip to main content

ASPxRichEdit.InsertContentToClient Event

Fires when the client RichEditCommands.insertContentFromServer command is executed.

Namespace: DevExpress.Web.ASPxRichEdit

Assembly: DevExpress.Web.ASPxRichEdit.v23.1.dll

NuGet Package: DevExpress.Web.Office


public event InsertContentToClientEventHandler InsertContentToClient

Event Data

The InsertContentToClient event's data class is InsertContentToClientEventArgs. The following properties provide information specific to this event:

Property Description
KeepLastParagraph Gets or sets whether the last paragraph of the inserted document is kept in the resulting document.
RequestId Gets the identifier of the request to the server.
Result Specifies the value passed to the client model.


Use the InsertContentToClient event’s handler to create a server-side document’s model and pass it to the client model. The model is passed to the client using the e.Result parameter as 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;

Note that the e.Result parameter should be represented by a string or the Document class’s instance.

See Also