HTML Editor for ASP.NET AJAX

Basic Edition
Frequently Asked Questions


  1. How do I modify the toolbars?

    The editor property Toolbars is a string that defines the elements displayed in each toolbar, in which toolstrip, in what order, etc.

    • Each toolbar element has a type and name
    • Buttons are the default type, so only their name is required
    • Multiple toolbars can be defined
    • Related toolbar elements may be grouped into toolstrips
    • Separator bars can be added to group related elements within a toolstrip
    • To have no toolbars, set the property to an empty string

    The internally supported element names are:

    Standard Buttons Bold, Italic, Underline, Left, Center, Right, Justify, OrderedList, BulletedList, Rule, Indent, Outdent, Subscript, Superscript, Link, Image, ForeColor, BackColor
    Optional Buttons Save, New, Design, Html, View
    Select Lists Format, Font, Size

    The following delimiters are used in the definition:

    ; Semi-colon ends a toolbar (not required for last toolbar)
    : Colon ends a toolstrip (not required for last toolstrip in a toolbar)
    , Comma separates toolbar elements
    | Vertical bar defines a separator
    # Pound sign separates an element type from its name

  2. How do I get a reference to the editor in my client-side JavaScript?

    In your client-side code use the Microsoft AJAX "$find" syntax to get a reference to the editor's client-side object.
    function GetHtmlEditor()
    {
        return $find('<%= Editor.ClientID %>');
    }
    
  3. Why do some tags and attributes not "stick"?

    The editor constrains tags and attributes to those explicitly "allowed":

    • If OutputXHTML is set to true (the default) the editor ignores all tags and attributes that are not on the allowed lists
    • Two properties, AllowedTags and AllowedAttributes, define what is allowed
    • The default allowed tags and attributes include only those required to support the normal expected usage of the editor
    • To add or remove allowed tags and attributes modify the properties in the Properties View in Visual Studio

  4. Why are my changes to the text not saved?

    The AutoSave functionality works automatically as part of the client-side ASP.NET validation process when the page is submitted. All controls with their CausesValidation property set to true (the default) trigger this behavior. If the standard client-side validation process does not take place on postback the editor's client-side Save method should be triggered through one of two methods:

    • The ID of the button control(s) that should trigger the Save should be listed in the SaveButtons property. The editor finds the controls with the ID's listed and automatically modifies their OnClientClick property.
    • The appropriate client-side script can be manually added. In general, the OnClientClick property of the button control(s) should be modified to $find the client-side editor object and call Save.
      OnClientClick="GetHtmlEditor().Save()"

  5. How do I change the default font in Design mode?

    To apply developer-specified style rules during Design mode editing set the DesignModeCss property to the path of the appropriate css file.

    Set the property declaratively in the HtmlEditor tag:
    DesignModeCss = "~/Styles/HtmlEditor.css"
    
    Example css file:
    body
    {
        font-family: Verdana;
        font-size: 8pt;
    }