Back to Devexpress

HtmlEditorCssFile Class

aspnet-devexpress-dot-web-dot-aspxhtmleditor-1387fca1.md

latest4.0 KB
Original Source

HtmlEditorCssFile Class

Represents a link to the CSS file.

Namespace : DevExpress.Web.ASPxHtmlEditor

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

NuGet Package : DevExpress.Web

Declaration

csharp
public class HtmlEditorCssFile :
    CollectionItem
vb
Public Class HtmlEditorCssFile
    Inherits CollectionItem

The following members return HtmlEditorCssFile objects:

Remarks

The HtmlEditorCssFile represents a link to the CSS file which is linked to the web project. The HtmlEditorCssFile objects are held within the HtmlEditorCssFileCollection object and can be accessed by using the Collection<T>.Item property.

The path to a CSS file, which is referred to by the HtmlEditorCssFile object, can be defined via the HtmlEditorCssFile.FilePath property

Example

This example illustrates how to customize the ASPxHtmlEditor’s placeholders by using CSS styles.

aspx
<dx:ASPxHtmlEditor ID="ASPxHtmlEditor1" runat="server">
    <SettingsPlaceholders StartMark="[%" EndMark="%]" />
    <CssFiles>
        <dx:HtmlEditorCssFile FilePath="~/ContentStyles.css" />
    </CssFiles>
    <Placeholders>
        <dx:HtmlEditorPlaceholderItem Value="FirstName" />
        <dx:HtmlEditorPlaceholderItem Value="Date" />
    </Placeholders>
</dx:ASPxHtmlEditor>
css
.dxhePlaceholder {
    background-color: yellow;
}
.dxhePlaceholder:hover {
    background-color: orange;
}
.dxhePlaceholder.dxheSelected {
    background-color: red !important;
    color: white !important;
}
csharp
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e) {
        if (!IsPostBack)
            ASPxHtmlEditor1.Html = File.ReadAllText(Server.MapPath("~/Content.html"));
    }
}
vb
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        If Not IsPostBack Then
            ASPxHtmlEditor1.Html = File.ReadAllText(Server.MapPath("~/Content.html"))
        End If
    End Sub
End Class

Implements

IStateManager

IPropertiesOwner

IExpressionsAccessor

Inheritance

Object StateManager CollectionItem HtmlEditorCssFile

See Also

HtmlEditorCssFile Members

HTML Editor

DevExpress.Web.ASPxHtmlEditor Namespace