Skip to main content

PastedImageSavingEventArgs.SetAttribute(String, String) Method

Specifies any attribute (including the data-* attributes) of the resulting HTML element.

Namespace: DevExpress.Web.ASPxHtmlEditor

Assembly: DevExpress.Web.ASPxHtmlEditor.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public void SetAttribute(
    string name,
    string value
)

Parameters

Name Type Description
name String

A string value specifying the attribute name.

value String

A string value specifying the attribute’s new value.

Remarks

The following example illustrates how to use the ASPxHtmlEditor.PastedImageSaving event and the SetAttribute method to add attributes to the pasted element.

protected void ASPxHtmlEditor1_PastedImageSaving(object source, PastedImageSavingEventArgs e) {
    if (!e.IsValid) {
        e.SetAttribute("data-isvalid", "false");
        e.SetAttribute("src", "broken-image.png");
        e.SetAttribute("alt", "broken image");
    }
}
See Also