zoukankan      html  css  js  c++  java
  • ckeditor 在C#中使用

    l来源: http://www.cnblogs.com/jackcovey/archive/2010/04/19/1715646.html

    1.将ckeditor和ckfinder文件夹拷入项目文件夹中,刷新项目。

    2. 在添加编辑控件的页面(aspx)的head中加入

      <script src="ckeditor/ckeditor.js" type="text/javascript"></script>
        <script type="text/javascript" src="ckfinder/ckfinder.js"></script>

    3.插入代码:

        <asp:TextBox ID="i_content" runat="server" TextMode="MultiLine" Height="362px" 
                    Width="100%"></asp:TextBox>
        </div>

    <script type="text/javascript">
            CKEDITOR.replace('<%= i_content.ClientID %>', {skin : 'kama'}); 
    </script>

    4.在项目文件夹中加入uploads文件夹

    5.把文件夹中的bin目录下的dll文件添加到网站的引用中,防止出现找不到类的错误。(未能加载类型“CKFinder.Connector.Connector”。)

    6.修改页面的page指令ValidateRequest="false" 
    <%@ Page Language="C#" ValidateRequest="false" %>

    7.获取或设置编辑器中的内容 
    //获取编辑器中的内容 
    lblView.Text=Server.HtmlEncode( this.i_content.Text); 
    //设置编辑器中的内容 
    //txtContent.Text = Server.HtmlDecode("<h1>设置内容</h1>"); 
    一些用应中(如ajax应用)需要在客户端处理完所有的数据,然后用它自己的方式向服务器发送数据,在这些情况下,使用CKEditor API就足以轻松获取编辑器实例中的内容。例 如: <script type="text/javascript">
    var editor_data = CKEDITOR.instances.i_content.getData();
    </script>

    8.加入中文字体:

     

    打开CKeditor目录里的config.js,在

    CKEDITOR.editorConfig = function( config )
    {
    };
    里添加如下代码:

    config.font_names='宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;'+ config.font_names;

     

  • 相关阅读:
    新年初六
    新年初五
    新年初四
    Who moved my cheese?
    红螺寺踏春
    JSP基本语法--实例演练
    JSP基础语法--跳转指令 jsp:forward page
    JSP基本语法--包含指令<%@include file="路径"%> <jsp:include page>
    JSP基本语法--Page指令 <%@page 属性=”内容“%>
    JSP注释及scriptlet <%局部%><%!全局%><%=输出%>
  • 原文地址:https://www.cnblogs.com/y0umer/p/3839116.html
Copyright © 2011-2022 走看看