用网站ip做代理服务器,网站被谷歌降权,做个简单的app要多少钱,建站平台 阿里巴巴一般用到富文本编辑器的地方#xff1a;留言板#xff0c;论坛的发帖页以及回复页等。 所用软件VS2012旗舰版 KindEditor下载地址#xff08;本文实例中所用版本4.1.10#xff09;#xff1a;
http://download.csdn.net/detail/donggege214/8454299 官网#xff08;版本…
一般用到富文本编辑器的地方留言板论坛的发帖页以及回复页等。 所用软件VS2012旗舰版 KindEditor下载地址本文实例中所用版本4.1.10
http://download.csdn.net/detail/donggege214/8454299 官网版本可能会更新:
http://kindeditor.net/ 实现后效果 下面介绍如何具体实现。
一、目录结构图 二、详细步骤
1、将下载好的KindEditor解压到你的网站根目录例子中的根目录是KindEditor对着目录结构中那个“地球网KindEditor”右键添加引用-浏览-找到刚才解压文件夹里的asp.net目录下bin目录下的LitJSON.dll-确定。
2、添加web窗体-Default.aspx网页名字随便这里用的是默认的命名-确定。
1前台代码
% Page LanguageC# AutoEventWireuptrue CodeFileDefault.aspx.cs Inherits_Default % !DOCTYPE html html xmlnshttp://www.w3.org/1999/xhtml head runatserver meta http-equivContent-Type contenttext/html; charsetutf-8/ title/title link relstylesheet href/kindeditor-4.1.10/themes/default/default.css / link relstylesheet href/kindeditor-4.1.10/plugins/code/prettify.css / script charsetutf-8 src/kindeditor-4.1.10/kindeditor.js/script script charsetutf-8 src/kindeditor-4.1.10/lang/zh_CN.js/script script charsetutf-8 src/kindeditor-4.1.10/plugins/code/prettify.js/script script KindEditor.ready(function (K) { var editor1 K.create(#content1, { cssPath: /kindeditor-4.1.10/plugins/code/prettify.css, uploadJson: /kindeditor-4.1.10/asp.net/upload_json.ashx, fileManagerJson: /kindeditor-4.1.10/asp.net/file_manager_json.ashx, allowFileManager: true, afterCreate: function () { var self this; K.ctrl(document, 13, function () { self.sync(); K(form[nameexample])[0].submit(); }); K.ctrl(self.edit.doc, 13, function () { self.sync(); K(form[nameexample])[0].submit(); }); } }); prettyPrint(); }); /script /head body form idform1 runatserver div table stylewidth:500px tr td留言板/td /tr tr tdtextarea idcontent1 cols100 rows8 stylewidth:100%;height:200px;visibility:hidden; runatserver/textarea/td /tr tr td asp:Button IDButton1 runatserver TextButton / /td /tr /table asp:Label IDLabel1 runatserver/asp:Label /div /form /body /html
蓝色高亮显示部分是路径如果路径设置不正确那么调试时textarea是不会显示成富文本编辑框的。这里简单说一下“/”代表站点的根目录“../”代表上层目录。 2后台代码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Label1.Text Request.Form[content1]; } }
3Web.config
?xml version1.0? !-- 有关如何配置 ASP.NET 应用程序的详细信息请访问 http://go.microsoft.com/fwlink/?LinkId169433 -- configuration system.web compilation debugtrue targetFramework4.0/ pages validateRequestfalse / httpRuntime requestValidationMode2.0 / /system.web /configuration
如果这里不配置Web.config当文字有样式时会提示有危险值...的报错。当然这里将validateRequest设为false肯定会带来一些安全问题。目前不会更好的解决办法如果谁有欢迎分享~ 好了至此大功告成