第三方控件ckeditor和ckfinder

14年4月14 天气不错,今天见到了彤彤,晚上回来写代码

要写一个发布文章的页面,用到了第三方控件,富文本编辑器ckediter和ckfinder集成,写一个博客复习一下

首先是ckeditor的安装指导:http://docs.cksource.com/CKEditor_3.x/Developers_Guide/ASP.NET/Integration_Advanced

ckfinder的安装指导:http://docs.cksource.com/CKFinder_2.x/Developers_Guide/ASP.NET

 //将ckeditor添加到网站

•1.右键->管理NuGet程序包
•2.搜索CKEditor
•3.安装CKEditor和CKEditorForASP.NET
•4.将Scripts文件夹下的ckeditor文件夹移动到根目录下
•5.在页面中注册
•6.生成项目
•7.在页面中添加
 
 
//将第三方控件添加到工具箱里面
•右键->选择项->浏览->package->*.dll文件
 
//将ckfinder添加到网站
•1.复制文件夹
•2.添加引用
•3.解决错误
•(1)删除_sample和_source
•(2)添加引用: system.design.dll
•4.ckfinder->config.ascx中CheckAuthentication()方法
•5.PageLoad事件中添加代码
•参考http://docs.cksource.com/CKFinder_2.x/Developers_Guide/ASP.NET
//将ckeditor和ckfinder集成,把这句话添加到page_load里面

CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditor1);//这个参数是根据具体的名字变化的

 

//如果已经添加ckeditor引用了(可以从neget里面安装)

//下面这句话加到aspx最顶上,就可以创建控件了

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

// 创建控件

<CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server"></CKEditor:CKEditorControl>

 

//如果要使用ckfinder来上传图片等

//要记得把usersFiles文件夹里面的config.ascx

public override bool CheckAuthentication()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
//
//	 return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
//
// ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
// user logs on your system.

return true;//这里要改成return true;
}

  

posted @ 2014-04-14 01:48  爱y1彤真是太好了  阅读(327)  评论(0)    收藏  举报