ASPxRichEdit.InsertContentToClient Event
Fires when the client RichEditCommands.insertContentFromServer command is executed.
Namespace: DevExpress.Web.ASPxRichEdit
Assembly: DevExpress.Web.ASPxRichEdit.v24.2.dll
Declaration
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. |
Remarks
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>
<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>
function onInsertTextClick() {
richEdit.commands.insertContentFromServer.execute('text', 0, richEdit.document.mainSubDocument.id);
}
function onInsertModelClick() {
richEdit.commands.insertContentFromServer.execute('model', 0, richEdit.document.mainSubDocument.id);
}
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;
document.EndUpdateCharacters(charProps);
e.Result = document;
}
}
Note that the e.Result parameter should be represented by a string or the Document class’s instance.
See Also