Skip to main content

HtmlEditorPlaceholderItem.Value Property

Specifies the placeholder value.

Namespace: DevExpress.Web.ASPxHtmlEditor

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

NuGet Package: DevExpress.Web

Declaration

[DefaultValue("")]
public string Value { get; set; }

Property Value

Type Default Description
String String.Empty

An String that specifies the item value.

Example

This example demonstrates how to replace placeholders with data specified as an object. When the Insert Date button is clicked, the DateNow and TimeNow placeholders are replaced using the ASPxHtmlEditor.ReplacePlaceholders method’s ReplacePlaceholders(string html, object placeholders) overload.

<dx:ASPxHtmlEditor ID="HtmlEditor" ClientInstanceName="HtmlEditor" runat="server">
    <Toolbars>
        <dx:HtmlEditorToolbar>
            <Items> ... </Items>
        </dx:HtmlEditorToolbar>
    </Toolbars>
    <Placeholders>
        <dx:HtmlEditorPlaceholderItem Value="DateNow" />
        <dx:HtmlEditorPlaceholderItem Value="TimeNow" />
        <dx:HtmlEditorPlaceholderItem Value="FirstName" />
        <dx:HtmlEditorPlaceholderItem Value="LastName" />
    </Placeholders>
</dx:ASPxHtmlEditor>
<dx:ASPxButton ID="DateButton" runat="server" OnClick="Insert_Date" Text="Insert Date" />
private class PlaceholdersForDate {
    private DateTime date = DateTime.Now;
    private string formatDate = "d MMM yyyy";
    private string formatTime = "HH:mm";
    public string DateNow {
        get {
            return date.ToString(formatDate);
        }
    }
    public string TimeNow {
        get {
            return date.ToString(formatTime);
        }
    }
}
// Replaces placeholders specified as an object
protected void Insert_Date(object sender, EventArgs e) {
    PlaceholdersForDate placeholdersForDate = new PlaceholdersForDate();
    string html = HtmlEditor.Html;
    string newHtml = ASPxHtmlEditor.ReplacePlaceholders(html, placeholdersForDate);
    HtmlEditor.Html = newHtml;
}
See Also