在网站开发中难免会用到富文本编辑器,本文将介绍一款富文本编辑器(在线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. CSS计数器与动态计数呈现

    代码: CSS代码: body { counter-reset: icecream; } input:checked { counter-increment: icecream; } .total:: ...

  2. eMarketer:DMP帮广告主搞定大数据处理问题

    DMP(数据管理平台)帮助广告主获得可行动的洞察 在数字广告领域,大数据和数据管理平台(DPMs)仍大有可为.DMPs让广告主可以使用他们的大数据来做出更灵活更有效的营销决策. 数据管理和分析是业界挑 ...

  3. 将数组之中的省份市区地区ID改成对用中文字符

    数据表数据源的省市区联动: 原始数据: //获取所有学校信息 $school=D('school'); $info=$school->getList(); 数据如下: 1 => array ...

  4. 小鸟哥哥博客 For SAE

    独立博客地址:http://www.zhujiawei.com.cn/ 辞职后出去玩了几个月,把积蓄都快花光了,打算熬到年底再找工作.最近闲来无聊,想起自己一年前趁着活动便宜,一口气买了10年的域名一 ...

  5. TextView字符串波浪式跳动--第三方开源---JumpingBeans

    在github上有一个开源项目:JumpingBeans,其项目主页是:https://github.com/frakbot/JumpingBeans JumpingBeans将一个普通的Androi ...

  6. DevExpress LookUpEdit和ComboBoxEdit部分用法

    LookUpEdit 1.绑定列 (注意点:LookUpEdit1的FieldName要和绑定的列明一致) 方式一: LookUpEdit1.Properties.DisplayMember = &q ...

  7. 基于Memcached的Session共享问题

    把Memcached的key(Guid)写入浏览器的cookie(类比SessionId) 存值: string sessionId = Guid.NewGuid().ToString(); Comm ...

  8. AngularJs记录学习02

    <!doctype html> <html ng-app="myapp"> <head> <meta http-equiv="C ...

  9. Python开发【第一篇】Python基础之生成器和迭代器

    生成器和迭代器 1.生成器 一个函数调用时返回一个迭代器,那这个函数就叫做生成器(generator):如果函数中包含yield语法,那这个函数就会变成生成器: def func(): yield 1 ...

  10. ios 异步处理耗时操作

    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_asy ...