ASP.NET MVC 5 中 使用富文本编辑器 Ueditor
2015-03-09 15:38
106 查看
一、Ueditor插件下载自:http://ueditor.baidu.com/website/
二、将解压文件目录ueditor复制到项目根目录后,
修改以下几个文件配置:
1.访问路径配置:ueditor.config.js
//为编辑器实例添加一个路径,这个不能被注释
UEDITOR_HOME_URL: "http://localhost:4458/ueditor/"
// 服务器统一请求接口路径
, serverUrl: URL + "/net/controller.ashx"
2.上传文件相关配置config.json
"imageUrlPrefix": "/ueditor/net/", /* 图片访问路径前缀 */
"imagePathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
三、前台添加使用
1.引用脚本
<script type="text/javascript" src="~/Scripts/ueditor/ueditor.config.js" />
<script type="text/javascript" src=""~/Scripts/ueditor/ueditor.all.js />
或添加至BundleConfig,
bundles.Add(new ScriptBundle("~/bundles/ueditor").Include(
"~/Scripts/ueditor/ueditor.config.js",
"~/Scripts/ueditor/ueditor.all.js"));
在前台引用
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/ueditor")
}
2.将如下代码添加富文本输入框位置:
<script id="Location" type="text/plain" style="width:200px;height:100px;">
</script>
3.初始化
<script type="text/javascript">
var ue = UE.getEditor('Location');
</script>
4.前台显示
@Html.Raw(item.Location)
三、后台获取提交
1、提交的Action要取消验证,即添加ValidateInput(false)
[ValidateInput(false)]
public ActionResult Create([Bind(Include = "LastName,FirstMidName,HireDate,OfficeAssignment")] Instructor instructor, FormCollection fc, string[] selectedCourses){
…………
if ( fc != null && fc.Get("Location") != null)
string strdata= fc.Get("Location");//获取提交的编辑信息
}
二、将解压文件目录ueditor复制到项目根目录后,
修改以下几个文件配置:
1.访问路径配置:ueditor.config.js
//为编辑器实例添加一个路径,这个不能被注释
UEDITOR_HOME_URL: "http://localhost:4458/ueditor/"
// 服务器统一请求接口路径
, serverUrl: URL + "/net/controller.ashx"
2.上传文件相关配置config.json
"imageUrlPrefix": "/ueditor/net/", /* 图片访问路径前缀 */
"imagePathFormat": "upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
三、前台添加使用
1.引用脚本
<script type="text/javascript" src="~/Scripts/ueditor/ueditor.config.js" />
<script type="text/javascript" src=""~/Scripts/ueditor/ueditor.all.js />
或添加至BundleConfig,
bundles.Add(new ScriptBundle("~/bundles/ueditor").Include(
"~/Scripts/ueditor/ueditor.config.js",
"~/Scripts/ueditor/ueditor.all.js"));
在前台引用
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/ueditor")
}
2.将如下代码添加富文本输入框位置:
<script id="Location" type="text/plain" style="width:200px;height:100px;">
</script>
3.初始化
<script type="text/javascript">
var ue = UE.getEditor('Location');
</script>
4.前台显示
@Html.Raw(item.Location)
三、后台获取提交
1、提交的Action要取消验证,即添加ValidateInput(false)
[ValidateInput(false)]
public ActionResult Create([Bind(Include = "LastName,FirstMidName,HireDate,OfficeAssignment")] Instructor instructor, FormCollection fc, string[] selectedCourses){
…………
if ( fc != null && fc.Get("Location") != null)
string strdata= fc.Get("Location");//获取提交的编辑信息
}
相关文章推荐
- ASP.NET MVC 中使用 UEditor 富文本编辑器
- ASP.NET MVC异步上传图片和富文本编辑器的使用详解
- ASP.NET MVC异步上传图片和富文本编辑器的使用详解
- ASP.NET MVC使用UEditor,并与Controller共享
- ASP.NET MVC使用UEditor,并与Controller共享
- ASP.NET MVC异步上传图片和富文本编辑器的使用详解
- 在asp.net mvc中使用百度UEditor初始化内容遇到自数据库中读取的html字符串在UEditor中始终是html编码的问题
- 在ASP.Net MVC框架下使用富文本编辑器(FCKEditor,更新至:v1.0.1)(2010-05-22:已加上源代码)
- Asp.net Mvc 中使用UEditor
- 一步步教你在Asp.net Mvc中使用UEditor编辑器
- 关于asp.net mvc 使用ueditor添加内容 前端只显示原样标签的问题
- 在ASP.NET MVC中使用富文本编辑器禁用请求验证(以FckTextBox在线编辑器为例,其他的也是一样的)
- asp.net mvc abp(ASP.NET Boilerplate)集成百度Ueditor富文本编辑器
- ASP.NET MVC中使用Ajax.BeginForm()的例子
- ASP.NET MVC使用Bootstrap系列(1)——开始使用Bootstrap
- ASP.NET MVC使用Bootstrap系统(2)——使用Bootstrap CSS和HTML元素
- ASP.NET MVC使用Bootstrap系列(3)——使用Bootstrap 组件
- ASP.NET MVC使用Bootstrap系列(4)——使用JavaScript插件
- ASP.NET MVC使用Bootstrap系列(5)——创建ASP.NET MVC Bootstrap Helpers
- 基于ASP.NET的MVC框架下的MvcPaper分页控件的使用技术