FreeTextbox 不开源了,优快云用的这个在线编辑器很优秀.它的名字叫做FCKEditor,它是开源的.
FCKeditor
FCK的组成:
1.FCK核心文件(包括图片,JS...)
2.FCK.NET文件(就一个dll,名字叫FredCK.FCKeditorV2.dll)
FCK的安装
官方网站http://www.fckeditor.net/
官方文档http://wiki.fckeditor.net/
请输入大于5个字符的标题
还有一个是FCK.net就在下面,就不带图片了...
FCK的安装
下载回来以后,将两个文件分别解压,核心文件夹里的.js和.xml以及editor文件夹不要动,其他的文件嘛可以删除,不过我们不建议你这么做..因为FCK是适合很多语言的(比如asp,php...)所以一看就知道,其他文件就是用来做别的语言的工作的..
.net里的只有一个dll文件,在 FCKeditor.Net_2.2/bin/Debug目录下的FredCK.FCKeditorV2.dll...
修改fckconfig.js中的以下部分,将两行的asp都改成aspx...
var _FileBrowserLanguage = 'asp' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'asp' ; // asp | aspx | cfm | lasso | php
打开FCKPro工程的Web. Config文件,修改appSettings元素,配置如下:
<appSettings>
<add key="FCKeditor:BasePath"value="~/FCKeditor/"/>
<add key="FCKeditor:UserFilesPath"value="/FCKPro/Files" />
</appSettings>
配置Web.Config的目的在于我们想使用它强大的文件上传功能...
在工程中引用此dll,并在控件中也引用进来,这样就可以使用它了..
至于如何获取它的内容,很简单,就一句话FCKeditor1.Value就可以了
以下是代码页..
default.aspx |
----------------------|
<%@ Page Language="C#" validateRequest=false AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>FCKeditor文本编辑器</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fckeditorv2:fckeditor id="FCKeditor1" runat="server" DefaultLanguage="zh-cn" Height="400px" Width="660px"
></fckeditorv2:fckeditor>
<input type=submit /></div>
</form>
</body>
</html>
Default.aspx.cs |
------------------------|
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strsql = "select id,news from guestbook";
string conn = "provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath(".") + ".//db.mdb;";
OleDbConnection objconn = new OleDbConnection(conn);
OleDbDataReader objreader = null;
OleDbCommand mycmd = new OleDbCommand(strsql, objconn);
objconn.Open();
objreader = mycmd.ExecuteReader();
objreader.Read();
objreader.Read();
objreader.Read();//使用这么多次的Read是因为我想查看数据库里第5条数据
objreader.Read();
objreader.Read();
FCKeditor1.Value = (string)objreader["news"];
objreader.Close();
objconn.Close();
}
}
FCKeditor(asp.net)使用方法
最新推荐文章于 2025-04-08 17:22:17 发布