1.下载KindEditor文件包 ,并放入项目中,并在页面中加入引用
<title>无标题页</title>
<link rel="stylesheet" href="js/KingEditor/themes/default/default.css" />
<link rel="stylesheet" href="js/KingEditor/plugins/code/prettify.css" />
<script type="text/javascript" charset="utf-8" src="js/KingEditor/kindeditor.js"></script>
<script type="text/javascript" charset="utf-8" src="js/KingEditor/lang/zh_CN.js"></script>
<script type="text/javascript" charset="utf-8" src="js/KingEditor/plugins/code/prettify.js"></script>
<script type="text/javascript">
KindEditor.ready(function(K) {
var editor1 = K.create('#content1', {
cssPath : '../plugins/code/prettify.css',
uploadJson : '../asp.net/upload_json.ashx',
fileManagerJson : '../asp.net/file_manager_json.ashx',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=example]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=example]')[0].submit();
});
}
});
prettyPrint();
});
</script>
<body>
<form id="example" runat="server">
<div>
<textarea id="content1" cols="100" rows="8" style="width:700px;height:450px;visibility:hidden;" runat="server"></textarea>
<asp:Button ID="Button1" runat="server" Text="Button" οnclick="Button1_Click" />
<br />
</div>
</form>
</body>
2.在后台直接取值即可。还需要将<%@ Page Language="C#" AutoEventWireup="true" ValidateRequest="false" CodeFile="info.aspx.cs" Inherits="info" %> 取消特殊字符的验证拦截。