ASP.NET使用百度编辑器(UEditor)方法如下

第一步到百度官网下载百度编辑器

http://ueditor.baidu.com/website/download.html

下载.net版本

第二步:减压复制到自己项目下新建的文件夹Content(文件夹随意,自己定义)可以起个新的名字比如(ueditorUTF8)

第三步:添加引用,在项目中添加引用(选择浏览,在复制文件夹ueditorUTF8的net的bin目录下找到dll文件,添加引用)

第四步:修改图片访问路径找到net文件夹里面的config.json文件,在找到所有的 /* 图片访问路径前缀 */ 然后在前面的途径加上:/Content/

找到config.json

第五步:前端引入js路径这里的路径一定得引入真确,看看自己的编辑器在哪来放着然后分别引入三个文件:注意顺序不要错了

    <script type="text/javascript" charset="utf-8" src="../../Content/ueditorUTF8/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../Content/ueditorUTF8/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="../../Content/ueditorUTF8/lang/zh-cn/zh-cn.js"></script>

第六步:前端页面加入注意:下面的var ue = UE.getEditor('txtEditorContents');中的名称要与后面添加使用编辑器的名称一致

 <script type="text/javascript">

         //实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('txtEditorContents'); function isFocus(e) {
alert(UE.getEditor('editor').isFocus());
UE.dom.domUtils.preventDefault(e)
}
function setblur(e) {
UE.getEditor('editor').blur();
UE.dom.domUtils.preventDefault(e)
}
function insertHtml() {
var value = prompt('插入html代码', '');
UE.getEditor('editor').execCommand('insertHtml', value)
}
function createEditor() {
enableBtn();
UE.getEditor('editor');
}
function getAllHtml() {
alert(UE.getEditor('editor').getAllHtml())
}
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法可以获得编辑器的内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getContent());
alert(arr.join("\n"));
}
function getPlainTxt() {
var arr = [];
arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getPlainTxt());
alert(arr.join('\n'))
}
function setContent(isAppendTo) {
var arr = [];
arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
alert(arr.join("\n"));
}
function setDisabled() {
UE.getEditor('editor').setDisabled('fullscreen');
disableBtn("enable");
} function setEnabled() {
UE.getEditor('editor').setEnabled();
enableBtn();
} function getText() {
//当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容
var range = UE.getEditor('editor').selection.getRange();
range.select();
var txt = UE.getEditor('editor').selection.getText();
alert(txt)
} function getContentTxt() {
var arr = [];
arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
arr.push("编辑器的纯文本内容为:");
arr.push(UE.getEditor('editor').getContentTxt());
alert(arr.join("\n"));
}
function hasContent() {
var arr = [];
arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
arr.push("判断结果为:");
arr.push(UE.getEditor('editor').hasContents());
alert(arr.join("\n"));
}
function setFocus() {
UE.getEditor('editor').focus();
}
function deleteEditor() {
disableBtn();
UE.getEditor('editor').destroy();
}
function disableBtn(str) {
var div = document.getElementById('btns');
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
if (btn.id == str) {
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
} else {
btn.setAttribute("disabled", "true");
}
}
}
function enableBtn() {
var div = document.getElementById('btns');
var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
}
} function getLocalData() {
alert(UE.getEditor('editor').execCommand("getlocaldata"));
} function clearLocalData() {
UE.getEditor('editor').execCommand("clearlocaldata");
alert("已清空草稿箱")
}
</script>

第七步骤:在需要使用编辑器的地方添加一个TextBox控件,id="txtEditorContents"

比如:

 <dt>文章内容:</dt>
<dd style="line-height: 0; width: 89%">
<asp:TextBox ID="txtEditorContents" name="txtEditorContents" runat="server" TextMode="MultiLine" Height="400px" Width="1000px" ClientIDMode="Static ” </asp:TextBox>
</dd>

第八步骤:运行试试看红色边框中的别是显示出的效果,三个字来形容(萌萌哒)

第九步:提交的后台怎么获取编辑器输入的值     :通过textbox的id就可以得到如图接下来你就可以存储数据库等等操作了

以上就是我的总结,如有不对之处还望见谅!

ASP.NET使用百度编辑器(UEditor)使用方法的更多相关文章

  1. Asp.Net使用百度编辑器(ueditor)

    1.  1.4.3以上版本将不再承诺支持ie6/ie7. 2.如果是aspx 需要加上  ValidateRequest="false" 3.Web.config <syst ...

  2. 百度编辑器UEditor使用方法

    http://www.cnblogs.com/lionden/archive/2012/07/13/ueditor.html 介绍图片上传:http://uikoo9.com/blog/detail/ ...

  3. 百度编辑器ueditor插入表格没有边框颜色的解决方法

    附:从word excel 中 复制的表格提交后无边框,参考这个同学的,写的很详细:   http://blog.csdn.net/lovelyelfpop/article/details/51678 ...

  4. 百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法

    百度编辑器ueditor 异步加载时,初始化没办法赋值bug解决方法 金刚 前端 ueditor 初始化 因项目中使用了百度编辑器——ueditor.整体来说性能还不错. 发现问题 我在做一个编辑页面 ...

  5. 百度编辑器ueditor 在vs2008中的使用方法

    个人觉得百度编辑器ueditor还是不错的,虽然出生的时间比较短,但某些方面相比其它富文本编辑器更优秀,免费.可定制等等. 由于在官方下载的ueditor包是在vs2012下开发的,可以在vs2010 ...

  6. Ueditor百度编辑器中 setContent()方法的使用

    百度编辑器Ueditor所提供的setContent()方法作用是:设置或者改变编辑器里面的文字内容或html内容 函数说明:setContent(string,boolean); 参数string ...

  7. 百度编辑器ueditor插入表格没有边框,没有颜色的解决方法 2015-01-06 09:24 98人阅读 评论(0) 收藏

    百度富文本编辑器..很强大.. - - ,不过有些BUG..真的很无解.. 最近用这个,发现上传的表格全部没有表框.. 解决办法如下: 转载的.. 百度编辑器ueditor插入一个表格后,在编辑过程中 ...

  8. 百度编辑器ueditor前台代码高亮无法自动换行解决方法

    这两天本站成功安装整合了百度编辑器ueditor,用着还挺不错,但是遇到了点小问题 问题描述:   在内容里面插入代码高亮显示,后台编辑器中是可以自动换行的,但是发表后,在前台查看,发现代码不能自动换 ...

  9. [转载]百度编辑器-Ueditor使用

    前段时间发表过一篇关于“KindEditor在JSP中使用”的博文.这几天在沈阳东软进行JavaWeb方面的实习工作,在一个CMS系统的后台和博客板块中又要用到文本编辑器,突然发现了这个——百度编辑器 ...

随机推荐

  1. llinux 环境安装编译 nginx (源码安装包)

    简介: Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,供俄国 ...

  2. VS2015 applicationhost.config 本地域名访问

    .vs\config\applicationhost.config <?xml version="1.0" encoding="UTF-8"?> & ...

  3. 面向切面编程(AOP)简介

    在软件中,有些行为对于大多数应用都是通用的.日志,安全和事务管理几乎是所有软件都需要的.他们是否可以主动的参与呢,如果让应用程序只关注与自己所针对的业务领域问题,而其他的问题有其他应用对象来处理.是否 ...

  4. Blender下各种坐标系

    转载:https://jingyan.baidu.com/article/ed2a5d1f8f018309f7be1779.html 打开blender创建一个立方体.   切换到“自身”坐标系,旋转 ...

  5. ASP.NET程序也能像WinForm程序一样运行[转载]

    阅读目录 开始 操作方式 支持的ASP.NET程序类别 它也是个HTTP服务器 支持远程机器访问 不受限于Windows防火墙 尊重每个人的操作习惯 内置多标签浏览器支持 启动参数及配置文件 支持 . ...

  6. wordpress主题升级之后返回到原来版本主题的方法

    wordpress后台经常可以看到主题提示升级,但是发现升级之后样式,颜色等都变了,不是以前的样子了,这时候如果想要返回到以前版本,前提,必须以前版本有备份. 在wordpress里面找到主题===添 ...

  7. windows下nvm安装node之后npm命令找不到问题解决办法

    主要关键解解决办法:===>>适用于所有东西的安装 安装有关环境配置类的软件及其他,一般情况下切记不要安装到c盘programfiles下,否则会出现各种问题的报错!!!切记! nvm安装 ...

  8. 如何在eclipse中使用mvn clean install

    1.在Maven项目或者pom.xml上右键——>Run As ——>“Maven Build...”或者Run Configuration——>“Maven Build” 2.在“ ...

  9. php解析mpp文件中的多级任务

    获取层级的project任务  参考 启动javabridge java -jar JavaBridge.jar SERVLET_LOCAL:8089 1.读取mpp文件 $file_path = & ...

  10. Spring学习总结五——SpringIOC容器五

    一:spring组件扫描 可以使用注解的方式,代替在xml配置文件配置bean,可以减少配置文件的书写,只需要在spring容器配置 文件中配置<context:component-scan b ...