首先我们要有以下两个文件
1、下载FckEditor 2.3 Beta,它主要包括核心文件。
2、下载FckEditor 2.2 .Net ,包括ASP.NET的DLL文件,并且解压到任意目录。
3 我们新建一个网站,就叫FCK吧
4 把FckEditor 2.3 Beta里面的文件夹FCKeditor复制到网站的根目录
5 在网站根目录下新建uploads目录用来存放编辑器上传得文件
6 打开FCKeditor目录下的fckconfig.js文件
将FCKConfig.DefaultLanguage的值改为zh-cn使其的界面语言改变为简体中文,_FileBrowserLanguage和_QuickUploadLanguage的值都改为aspx。可选的修改如下,可以修改编辑器的skin,将FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' 的default可以该为office2003或者silver。保存修改,关闭文件。
新建Web.config文件
在<appSettings>节点下增加<add key="FCKeditor:UserFilesPath" value="/fck/uploads"/>。不知道为什么FCKeditor不支持相对路径,如果设置为“~/uploads”就是用不了,上传得文件地址都变成" http://localhost/~/uploads/xxxxxx.jpg"这样的了。在<system.web>节点下增加<pages validateRequest="false"/>,要不然当在编辑器里输入字符保存时,会出现“检测到有潜在危险对象的Request.form值”的警告,好了,保存文件。
在项目中引用FCKeditor.Net_2.2文件夹里的FredCK.FCKeditorV2.dll文件。具体位置是 FCKeditor.Net_2.2/bin/release/FredCK.FCKeditorV2.dll
打开项目的default.aspx页面
加入
程序代码
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
然后在default.aspx html 代码中加入
程序代码
<body>
<form id="form1" runat="server">
<div>
<fckeditorv2:fckeditor id="FCKeditor" runat="server" Width="580px" EnableXHTML="true" EnableSourceXHTML="true" basepath="~/FCKeditor/" height="500px"></fckeditorv2:fckeditor>
</div>
</form>
</body>
<form id="form1" runat="server">
<div>
<fckeditorv2:fckeditor id="FCKeditor" runat="server" Width="580px" EnableXHTML="true" EnableSourceXHTML="true" basepath="~/FCKeditor/" height="500px"></fckeditorv2:fckeditor>
</div>
</form>
</body>
在设计模式看看效果
在IE里看看效果如何
加一个button 和LABLE试下显示 效果
程序代码
protected void Button1_Click(object sender, EventArgs e)
{
this.Label1.Text = this.FCKeditor.Value;
}
{
this.Label1.Text = this.FCKeditor.Value;
}