Search code examples
c#jqueryhtmlcssradeditor

How to set inline style at RadEditor control's body element


I want to set inline style at body element of Telerik's Radeditor BUT i want to do this without the radeditor css file which is the official solution.

For example i want the body of the editor to have inline font-family when editor initialized.

It should be inline style for my purposes.I use radeditor as email editor ,so the body will get through sanitization providers.

Any solution either form client-side or from Code-behind C# will help.

Thanks in advance.


Solution

  • Here is an example on how to get reference to the content area on the client:

    <telerik:RadEditor
       ID="RadEditor1"
       OnClientLoad="OnClientLoad"
       runat="server">
    </telerik:RadEditor>
    ...
    <script type="text/javascript">
        function OnClientLoad(editor, args) {
            var style = editor.get_contentArea().style;
            style.backgroundImage = "none";
            style.backgroundColor = "black";
            style.color = "red";
            style.fontFamily = "Arial";
            style.fontSize = 15 + "px";
        }
    </script>