MVC中KindEditor的简单使用
来源:互联网 发布:wind金融数据客户端 编辑:程序博客网 时间:2024/06/05 08:26
第一:下载KindEditor
首先将下载好的最新的KindEditor放入到MVC项目中的Scripts文件夹中。
第二:添加HomeController
publicclass HomeController : Controller { public ActionResult Index() { return View(); } [ValidateInput(false)] [HttpPost] public ActionResult Show(string content) { ViewBag.Content = content; <span style="font-family: Arial, Helvetica, sans-serif;">return View();</span> } }
注意ValidateInput特性设置为false,否则无法插入Html标记。
第三:在视图中添加脚本
<script src="../../Scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script><script type="text/javascript"> KindEditor.ready(function (K) { var options = { uploadJson: '../scripts/kindeditor/asp.net/upload_json.ashx', fileManagerJson: '../scripts/kindeditor/asp.net/file_manager_json.ashx', allowFileManager : true }; window.editor = K.create('#content', options); }); function Show(){var content = window.editor.html(); $.ajax({ type: "POST", url: "/ConventionConfig/Show", data: "content=" + content, success: function () { } })}</script><h2>KindEditor4编辑器</h2> @Html.Raw(@ViewBag.Content) @using (Html.BeginForm()){ <textarea id="content" name="content" style="width:700px;height:300px;"></textarea> <input id="OK" class ="easyui-linkbutton" type="button" style ="margin-left :200px;" value="提交" onclick="Show()" />}
- uploadJson和fileManagerJson设置值要注意路径名称
- window.editor = K.create('#content', options);中的#content要与textarea标记的id一致
- 显示输出时,使用Html.Raw辅助方法才能正确显示Html
第四:在客户端添加LitJSON.dll引用
项目引用KindEditor/asp.net/bin目录下的LitJSON.
最后,运行就可以看到效果。
0 0
- MVC中KindEditor的简单使用
- Asp.net MVC中使用KindEditor上传本地图片的注意事项
- ckeditor和KindEditor编辑器的简单使用
- 前端——kindEditor的简单使用
- kindeditor简单使用
- kindeditor 的简单实用
- kindeditor 文本框编辑器 简单使用
- kindEditor编辑器的使用
- 关于KindEditor的使用
- KindEditor编辑器的使用
- KindEditor的使用
- kindEditor编辑器的使用
- KindEditor插件的使用
- Kindeditor的使用
- KindEditor编辑器的使用
- kindeditor的使用
- KindEditor的使用
- kindeditor的使用
- HTML <!DOCTYPE> 标签
- PHP 开发中遇到的 Commands out of sync; you cant't run this command now 错误 解决方法
- mysql的权限分配和回收
- AppCan获得B轮1亿元融资并宣布移动引擎开源
- 1067. Sort with Swap(0,*) (25)
- MVC中KindEditor的简单使用
- java使用数组实现队列
- HTML5 Canvas实现贪吃蛇(二)
- Tomcat7中 javax.el.ELException 异常信息的处理
- 机器学习笔记(三)
- Android缓存处理
- storm-hdfs RotationActions 接口用法
- SQLServer 代理 停止时设置定时检查启动
- Android学习:初识Notification