Skip to main content

HtmlEditorCssFile.FilePath Property

Gets or sets the path of the associated CSS file.

Namespace: DevExpress.Web.ASPxHtmlEditor

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

NuGet Package: DevExpress.Web

Declaration

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

Property Value

Type Default Description
String String.Empty

A string value that specifies the CSS file path.

Remarks

Use this property to specify the path to a file that stores the CSS style settings. This CSS file’s classes can be used to define the ToolbarCustomCssListEditItem.CssClass properties of the ToolbarCustomCssEdit‘s list items.

Example

This example demonstrates how to programmatically create the standard toolbar item of the ToolbarCustomCssEdit type, and add the CSS file to the web project.

In order to specify a css file that contains definitions of custom css classes, the ASPxHtmlEditor.CssFiles property of the ASPxHtmlEditor can be used. The display text of an editor item can be defined using the item’s ListEditItem.Text property. An item’s ToolbarCustomCssListEditItem.CssClass and ToolbarCustomCssListEditItem.TagName properties are used to associate the item with the corresponding css class name, which defines a specific formatting, and specify the name of a tag to wrap the text content to which the associated style will be applied. The preview style of the item displayed within the drop down list of the ToolbarCustomCssEdit object is defined by using the ToolbarCustomCssListEditItem.PreviewStyle property.

<dx:ASPxHtmlEditor ID="ASPxHtmlEditor1" runat="server">
</dx:ASPxHtmlEditor>
protected void Page_Load(object sender, EventArgs e) {
    HtmlEditorCssFile myCss = new HtmlEditorCssFile();
    myCss.FilePath = "~/Css/Custom.css";
    ASPxHtmlEditor1.CssFiles.Add(myCss);
    CustomToolbar myToolbar = new CustomToolbar();
    ToolbarCustomCssEdit myToolbarButton1 = new ToolbarCustomCssEdit();
    ToolbarCustomCssListEditItem CustomStyle1 = 
        new ToolbarCustomCssListEditItem("Header1", "h1", "CommonHeader1");
    ToolbarCustomCssListEditItem CustomStyle2 = 
        new ToolbarCustomCssListEditItem("Header2", "h2", "CommonHeader2");
    CustomStyle1.PreviewStyle.CssClass = "CommonHeader1";
    CustomStyle2.PreviewStyle.CssClass = "CommonHeader2";
    myToolbarButton1.Items.Add(CustomStyle1);
    myToolbarButton1.Items.Add(CustomStyle2);
    myToolbar.Items.Add(myToolbarButton1);
    ASPxHtmlEditor1.Toolbars.Add(myToolbar);
}
See Also