当前位置:编程学习 > asp >>

ASP.NET下在线编辑器FreeTextBox与FCKeditor快速使用

一、FreeTextBox(版本3.2.1)

 


[html]
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %> 

<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>5、引用控件的html代码:


[html]
<FTB:FreeTextBox Text="" Language="zh-CN" ToolbarStyleConfiguration="OfficeMac"  ID="ftbContent" Width="100%" Height="300px" runat="server"> 
</FTB:FreeTextBox> 

<FTB:FreeTextBox Text="" Language="zh-CN" ToolbarStyleConfiguration="OfficeMac"  ID="ftbContent" Width="100%" Height="300px" runat="server">
</FTB:FreeTextBox>6、后端页面控件使用代码如下:


[csharp]
ftbContent.Text = "<p>wnaghengheng</p>"; 
string result = ftbContent.Text; 

ftbContent.Text = "<p>wnaghengheng</p>";
string result = ftbContent.Text;
二、FCKeditor(版本2.2)

1、下载FCKeditor2.4.2.zip和   FCKeditor.NET版的2个zip包,解压得到FCKeditor文件夹及FredCK.FCKeditorV2.dll;

2、将FredCK.FCKeditorV2.dll复制到项目的bin文件下,FCKeditor文件夹复制到项目根目录下,并在项目根目录新建Files文件夹用来存放FCKeditor上传的文件;

3、右键“引用”->”添加引用“->"浏览",找着FredCK.FCKeditorV2.dll,确定引用FredCK.FCKeditorV2.dll;

4、打开项目web.config,在<appSettings>节点下添加以下三项:


[html]
<add key="FCKeditor:BasePath" value="~/FCKeditor/"/> 
<add key="FCKeditor:UserFilesPath" value="~/Files/"/> 
<add key="FCKeditor:UploadDeniedExtensions" value=".php|.php3|.php5|.phtml|.asp|.aspx|.ascx|.jsp|.cfm|.cfc|.pl|.bat|.exe|.dll|.reg|.cgi|.cs|.vb|.asa|.cer|c.dx|.ascx|.asax|.ashx|.asmx|.java|.jsl"/> 

    <add key="FCKeditor:BasePath" value="~/FCKeditor/"/>
    <add key="FCKeditor:UserFilesPath" value="~/Files/"/>
    <add key="FCKeditor:UploadDeniedExtensions" value=".php|.php3|.php5|.phtml|.asp|.aspx|.ascx|.jsp|.cfm|.cfc|.pl|.bat|.exe|.dll|.reg|.cgi|.cs|.vb|.asa|.cer|c.dx|.ascx|.asax|.ashx|.asmx|.java|.jsl"/>5、新建一个aspx页面,先注册一下控件,代码如下(加在@ Page之后):


[html]
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %> 

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>6、引用控件的html代码:


[html]
<FCKeditorV2:FCKeditor  id="txtBody" runat="server" BasePath="~/FCKeditor/" Width="100%" ToolbarStartExpanded="false" Height="380px"> 
</FCKeditorV2:FCKeditor> 

<FCKeditorV2:FCKeditor  id="txtBody" runat="server" BasePath="~/FCKeditor/" Width="100%" ToolbarStartExpanded="false" Height="380px">
</FCKeditorV2:FCKeditor>7、后端页面控件使用代码如下:


[html]
txtBody.Value = "<p>wnaghengheng</p>"; 
string result = txtBody.Value; 

txtBody.Value = "<p>wnaghengheng</p>";
string result = txtBody.Value;
三、使用效果


FreeTextBox截图:

 

\

FCKeditor截图:

 

\

注:这里介绍的两个编辑器使用的版本都比较老,新版本可能会有出入,使用时请注意!

 

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,