在网站开发中难免会用到富文本编辑器,本文将介绍一款富文本编辑器(在线HTML编辑器) Rich Text Editor ,简要说明一下其在MVC中的使用。

具体使用情况和下载地址请参考:http://www.richtexteditor.com/

一、准备工作

1.在上述网站中下载此编辑器的开发包,解压后会发现有几个文件夹,如图:

我使用的是Asp.Net MVC4 版本,开发是c#,请大家选择适合自己的开发包。

2.进入该文件(mvc4_cs_razor),把 richtexteditor 开发包文件夹复制到你的项目根目录下,并复制 bin 目录下的几个dll文件至你的项目bin文件夹下,如图:

复制后,项目下就有了这些文件,如图:

3. 添加对该编辑器DLL的引用(两个DLL:NetSpell.SpellChecker.dll 和 RichTextEditor.dll),如图:

4.修改配置文件:

IIS5,IIS6,IIS7 经典模式使用如下配置信息

<configuration>
<system.web>
<httpModules>
<add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>
</httpModules>
</system.web>
</configuration>

IIS7 集成模式使用如下配置信息

<configuration>
<system.webServer>
<modules>
<add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>
</modules>
</system.webServer>
</configuration>
二、在代码中如何使用

做完上述准备工作后,就开始在代码中使用了

1.发布新闻时

[CheckLoginAttributer]
public ActionResult Create()
{
Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Content");
Editor1.MvcInit();
ViewBag.Editor = Editor1.MvcGetString(); return View();
}

图解:

2.编辑新闻时,新闻内容是怎么赋值的呢?

//
// GET: /News/Edit/5
[CheckLoginAttributer]
public ActionResult Edit(Guid id)
{
News news = db.News.Find(id);
if (news == null)
{
return HttpNotFound();
} Editor Editor1 = new Editor(System.Web.HttpContext.Current, "Content");
Editor1.Text = news.Content;
Editor1.MvcInit();
ViewBag.Editor = Editor1.MvcGetString(); return View(news);
}

图解:

Rich Text Editor for MVC的更多相关文章

  1. web & Rich Text Editor

    web & Rich Text Editor 富文本编辑器 http://www.wangeditor.com/ https://github.com/wangfupeng1988/wangE ...

  2. DevExpress ASP.NET Core v19.1版本亮点:Rich Text Editor

    行业领先的.NET界面控件DevExpress 发布了v19.1版本,本文将以系列文章的方式为大家介绍DevExpress ASP.NET Core Controls v19.1中新增的一些控件及增强 ...

  3. CKEditor 4 & markdown & rich text editor

    CKEditor 4 ckeditor 4 http://ckeditor.com

  4. NicEdit - WYSIWYG Content Editor, Inline Rich Text Application

    NicEdit - WYSIWYG Content Editor, Inline Rich Text Application By calling the nicEditors.allTextarea ...

  5. selenium处理rich text(富文本框)

    WordPress 的 rich  text 采用js,先让selenium切换到iframe中 driver.switchTo().frame("content_ifr"); 然 ...

  6. CHtmlEditCtrl (2): Add a Source Text Editor to Your HTML Editor

    In a previous article, I described how to create an HTML editor using the MFC CHtmlEditCtrl class in ...

  7. 【转】(八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text

    原创至上,移步请戳:(八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text 7.Rich Text UI元素和文本网格的文本可以合并多个字体样式和大小.对 UI系统 ...

  8. Selenium Webdriver——JS处理rich text(富文本框)

    126邮件正文邮件的rich text 先让selenium切换到iframe中 driver.switchTo().frame(driver.findElement(By.className(&qu ...

  9. (八)unity4.6Ugui中文教程文档-------概要-UGUI Rich Text

    大家好,我是孙广东. 转载请注明出处:http://write.blog.csdn.net/postedit/38922399 更全的内容请看我的游戏蛮牛地址:mod=guide&view ...

随机推荐

  1. div左右布局

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 <!DOCTYPE html> <html>     <head> ...

  2. jquery实现radio按纽全不选和checkbox全选的实例

    用jquery实现以下两个这个功能: 1.对所有单选按纽中radio全不选 单选按纽:<input type="radio" name="f1">A ...

  3. 一幅图证明chrome的由来和目的

  4. C# 编译JS -Evaluator

    忘记哪里转过来的,自己mark一下 //// <summary> /// 动态求值 /// </summary> public class Evaluator { /// &l ...

  5. spring事物的七种事物传播属性行为及五种隔离级别

    首先,说说什么事务(Transaction). 事务,就是一组操作数据库的动作集合.事务是现代数据库理论中的核心概念之一.如果一组处理步骤或者全部发生或者一步也不执行,我们称该组处理步骤为一个事务.当 ...

  6. flask-cors 实现跨域请求

    安装:pip install -U flask-cors from flask import Flask from flask.ext.cors import CORS app = Flask(__n ...

  7. Android工具与其它

    文本文件: Tool: NotePad++ 代码工具: Tool:Eclipse+STAN+(乱七八糟c,c++,java,android),Source Insight 3 Log工具: Tool: ...

  8. 九度oj 1348 数组中的逆序对

    原题链接:http://ac.jobdu.com/problem.php?pid=1348 归并排序求逆序对... #include<algorithm> #include<iost ...

  9. VS2010遇到_WIN32_WINNT宏定义问题

    最近拿到一个别人的工程,是使用VS.net创建的,而我的机器上只有vs2010,于是用自带的转换工具将它转换成vs2010的工程,转换之前我就很担心,怕转换完后会出问题,但是没有办法,我实在是不想再安 ...

  10. ASP.NET MVC掉过的坑_MVC初识及MVC应用程序结构

    APS.Net MVC 浅谈[转] 来自MSDN 点击访问 MVC 理论结构 模型-视图-控制器 (MVC) 体系结构模式将应用程序分成三个主要组件:模型.视图和控制器. ASP.NET MVC 框架 ...