kindeditor在asp.net中的使用
1.新建项目,建立editer文件夹,在editer文件夹下加入如下文件,目录结构如下:
<!--StartFragment -->
<!--StartFragment -->
2.在页面添加如下引用:
Java代码:
<link rel="stylesheet" href="editer/themes/default/default.css" />
<link rel="stylesheet" href="editer/plugins/code/prettify.css" />
<script charset="utf-8" src="editer/kindeditor.js"></script>
<script charset="utf-8" src="editer/lang/zh_CN.js"></script>
<script charset="utf-8" src="editer/plugins/code/prettify.js"></script>
3.在页面添加如下初始化代码:
C#代码:
<script>
KindEditor.ready(function (K) {
var editor1 = K.create('<span style="color: #ff0000;">#content1'</span>, {
cssPath: 'editer/plugins/code/prettify.css',
uploadJson: 'editer/asp.net/upload_json.ashx',
fileManagerJson: 'editer/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>
4.在页面中使用:
Java代码:
<textarea id="<span style="color: #ff0000;">content1</span>" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;“
runat="server"></textarea>
5.修改 file_manager_json.ashx,在什么目录结构中,上传文件路径为upload。
Java代码:
//根目录路径,相对路径
String rootPath = <span style="color: #ff0000;">"/upload/</span>";
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
String rootUrl = <span style="color: #ff0000;">"/upload</span>/";
6.修改upload_json.ashx
原文参考自站长网http://www.software8.co/wzjs/ASPjiaocheng/2721.html
C#代码:
//文件保存目录路径
String savePath = <span style="color: #ff0000;">"/upload</span>/";
//文件保存目录URL
String saveUrl = "/<span style="color: #ff000
补充:Web开发 , ASP.Net ,