CKEditor 3.1 初次在.net中的应用笔记

CKEditor 3.1 下载地址

 

官网上的简介:

 

CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.

 

CKEditor is not a desktop application like Microsoft Word or OpenOffice. It's a component to be used by developers to enhance their applications. It's an editor to be used inside web pages.

 

CKEditor inherits the quality and strong features people were used to find in FCKeditor, in a much more modern product, added by dozens of new benefits, like accessibility and ultimate performance.

 

ASP.NET上应用:

 

1.下载、配置:

下载这个组件包后解压出“ckeditor”文件夹:

使用以下文件即可:

  • adapters(文件夹)
  • images(文件夹)
  • lang(文件夹)
  • plugins(文件夹)
  • skins(文件夹)
  • themes(文件夹)
  • ckeditor.js
  • contents.css

其他文件和文件夹都可以删除,无实用价值,将这个ckeditor文件夹放到asp.net网站的根目录待用。

 

2.在.aspx页面上引用:

 

注意点:

  • 需要修改页头的ValidateRequest属性值为false,即<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" ValidateRequest="false" %>,否则提交页面到服务器会报错,如下显示:

 

 从客户端(editor1="<p>
This is some <...")中检测到有潜在危险的 Request.Form 值。


说明: 请求验证过程检测到有潜在危险的客户端输入值,对请求的处理已经中止。该值可能指示危及应用程序安全的尝试,如跨站点的脚本攻击。通过在 Page 指令或 配置节中设置 validateRequest=false 可以禁用请求验证。但是,在这种情况下,强烈建议应用程序显式检查所有输入。

异常详细信息: System.Web.HttpRequestValidationException: 从客户端(editor1="<p>
This is some <...")中检测到有潜在危险的 Request.Form 值。

 

  • head中添加ckeditor.js的引用,即<script type="text/javascript" src="ckeditor/ckeditor.js "></script>
  • 在服务器控件TextBox中添加引用,需要设置控件属性TextMode="MultiLine",并设置class="ckeditor", 即<asp:TextBox ID="txtEditor" runat="server" MaxLength="500" TextMode="MultiLine" class="ckeditor" ></asp:TextBox>

3.至此TextBox可以作为正常的服务器控件调用

 

可以在服务器端获取客户端用户输入的Text属性值

 

 

未完待续……

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值