如何更改rad编辑器的背景颜色?

时间:2013-04-29 06:16:16

标签: c# asp.net telerik background-color radeditor

以下是rad编辑器的编码,

<telerik:RadEditor ID="RadEditor1" runat="server" AutoResizeHeight="True"
Width="500px" ToolbarMode="Floating">
<Content>
</Content>
<ImageManager EnableAsyncUpload="True" ViewPaths="~/photos" />
<TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
</telerik:RadEditor>

但是,我的rad编辑器的背景颜色(1)显示了我的页面的背景颜色(2)。 如何更改编辑器的背景颜色?

enter image description here

2 个答案:

答案 0 :(得分:2)

要更改外观,必须在RadEditor中引用新样式表。 这是一个例子。

有关详细信息,请查看此处:

http://www.telerik.com/help/aspnet-ajax/editor-setting-editor-background-and-color.html http://www.telerik.com/help/aspnet-ajax/editor-setting-content-area-defaults.html http://www.telerik.com/help/aspnet-ajax/editor-content-area-appearance-problems.html http://www.telerik.com/help/aspnet-ajax/editor-css-classes-and-their-use.html

<强> ASPNET


<telerik:radeditor runat="server" ID="RadEditor1">
 <CssFiles>
     <telerik:EditorCssFile Value="~/EditorContentArea.css" />
 </CssFiles>
</telerik:radeditor>

CSS

body
{
  background-color: red;
  background-image: url(image_path);
  color: black;
}

<强> ASPX


<telerik:RadEditor
   ID="RadEditor1"
   OnClientLoad="OnClientLoad"
   runat="server">
</telerik:RadEditor>

<强> JAVASCRIPT

<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";
}

答案 1 :(得分:1)

将RadEditor属性ContentAreaCssFile设置为CSS文件。在CSS文件中,您可以定义内容区域的样式。

ContentAreaMode必须设置为Iframe才能实现此目的。

<telerik:RadEditor ID="RadEditor1" runat="server" 
    ContentAreaCssFile="ContentAreaCssFile.css" ContentAreaMode="Iframe">
  <Content>

  </Content>
</telerik:RadEditor>