Back to Devexpress

ASPxHtmlEditor.PastedImageSaving Event

aspnet-devexpress-dot-web-dot-aspxhtmleditor-dot-aspxhtmleditor-0153a263.md

latest5.4 KB
Original Source

ASPxHtmlEditor.PastedImageSaving Event

Allows you to process and save the pasted binary image to the server.

Namespace : DevExpress.Web.ASPxHtmlEditor

Assembly : DevExpress.Web.ASPxHtmlEditor.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event PastedImageSavingEventHandler PastedImageSaving
vb
Public Event PastedImageSaving As PastedImageSavingEventHandler

Event Data

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

PropertyDescription
CallbackDataGets or sets a string that contains specific information (if any) to be passed from the server side to the client. Inherited from FileUploadCompleteEventArgs.
CancelIndicates if the action which raised the event should be canceled. Inherited from FileSavingEventArgs.
ErrorTextGets or sets the error text. Inherited from FileUploadCompleteEventArgs.
FileNameGets or sets the name of the uploaded file. Inherited from FileSavingEventArgs.
InnerHTMLGets or sets HTML content (inner HTML) that will be rendered inside the HTML tag specified in the PastedImageSavingEventArgs.TagName property.
IsValidGets or sets a value specifying whether the uploaded file passes validation. Inherited from FileUploadCompleteEventArgs.
OutputStreamSet this property to change the original file content. Inherited from FileSavingEventArgs.
SavedFileUrlGets or sets the URL of the saved file. Inherited from FileSavingEventArgs.
TagNameGets or sets the root HTML element of the resulting HTML element.
UploadedFileGets the uploaded file object related to the event. Inherited from FileUploadCompleteEventArgs.

The event data class exposes the following methods:

MethodDescription
SetAttribute(String, String)Specifies any attribute (including the data-* attributes) of the resulting HTML element.
SetStyleAttribute(String, String)Specifies a CSS property in the ‘style’ attribute of the resulting HTML element.

Remarks

Handle the PastedImageSaving event to process the pasted binary image before it is saved to the server. This event also fires during the server side processing of the pasted RTF content in case it contains images. To process other images, video, and flash files before saving them to the server after uploading, handle the ASPxHtmlEditor.ImageFileSaving event (that fires after the PastedImageSaving event if the IsValid property is set to true or the FileSavingEventArgs.Cancel property is set to false).

Setting the IsValid property to false and specifying the ErrorText property fires the client ASPxClientHtmlEditor.CallbackError event.

The following examples illustrate how to use the PastedImageSaving event to process and customize the pasted binary image.

  • Customized image styles

  • Changed render for the image element

Note

The PastedImageSaving event is in effect if the ASPxHtmlEditorSettings.AllowSaveBinaryImageToServer property is set to true.

See Also

ImageFileSaving

ASPxHtmlEditor Class

ASPxHtmlEditor Members

DevExpress.Web.ASPxHtmlEditor Namespace